Mensaje
 
a
29/05/2008 15:27:52
Sammy Derban
Ghana Telecom
Accra, Ghana
General information
Foro:
ASP.NET
Category:
Web forms
Miscellaneous
ID de la conversación:
01320027
ID del mensaje:
01320599
Views:
17
>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
Responder
Mapa
Ver