I'm defining a GridView as follows:
<asp:GridView ID="MediaViewsGrid" DataSourceID="MediaViewsDataSource"
runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:CommandField ShowEditButton="True" ShowDeleteButton="true" />
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblLanguage" runat="server" Text='<%# Eval("Language.Name") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlLanguages"
DataSourceID="LanguageDataSource"
DataTextField="Name"
DataValueField="Code"
OnDataBound="ddlLanguages_OnDataBound"
runat="server" />
</EditItemTemplate>
</asp:TemplateField>
I'm trying to set a default value for my ddlLanguages drop down list when user clicks on "edit". Is the correct solution to define an OnDataBound function and set the selected index there?
If so, how do i do it? Or is there a better solution?