Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting Values to Formview Controls Just before insert M
Message
 
 
To
29/05/2008 15:27:52
Sammy Derban
Ghana Telecom
Accra, Ghana
General information
Forum:
ASP.NET
Category:
Web forms
Miscellaneous
Thread ID:
01320027
Message ID:
01320599
Views:
15
>Thanks so much Naomi, That was very helpful. You seem to know everything.
>Thanks once again.

Hi Sammy,

The sample in the link was a little bit confusing, I think. Here is what I just got working:
#region SQL DataSource Inserting - setting parameters

    protected void DataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
    //    foreach (System.Data.Common.DbParameter par in e.Command.Parameters) {
    //        Response.Write (par.ParameterName + " = " + par.Value.ToString()  + "<br //>") ;
    //    }
        e.Command.Parameters["@PersonType"].Value = ViewState["PersonType"];//this.PersonType ;
    }
    #endregion
I changed from ControlParameter to just Parameter because I didn't want to keep my combobox to enable state. So, I had to use ViewState to set the combo's value.

I could not find a better way except for changing EnableViewState in code (it also worked).

However, somehow the other way didn't sound too good to me.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform