Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting Values to Formview Controls Just before insert M
Message
 
 
À
29/05/2008 15:27:52
Sammy Derban
Ghana Telecom
Accra, Ghana
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Divers
Thread ID:
01320027
Message ID:
01320599
Vues:
16
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform