Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DropDownlist initial value
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01314718
Message ID:
01314740
Vues:
8
>>Hi
>>
>>I've got a dropdownlist in the edittemplate of a listview.
>>
>>I want to set an initial value for the dropdownlist but can't find it.
>>I'm trying to set it here.
>>But this returns null
>>This isn't all the code but shows where I'm trying to access the dropdownlist.
>>
>>Any thoughts on the best place to get this value set ?
>>
>
>You almost had it, try this instead:
>
>
>protected void DropDownList2_DataBound(object sender, EventArgs e)
>{
>   DropDownList newstypelkup = e.FindControl("DropDownList2") as DropDownList;
>   if (newstypelkup != null)
>   {
>      // Set value here
>   }
>}
>
Mike that doesn't build as I get

'System.EventArgs' does not contain a definition for 'FindControl' and no extension method 'FindControl' accepting a first argument of type 'System.EventArgs' could be found (are you missing a using directive or an assembly reference?)

Also my problem is that control is not being found so it would still return null.

Nick
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform