M
Maziar Aflatoun
Hi everyone,
I have the following code
<asp:TemplateColumn HeaderText="Administator" Visible="True"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="IsAdministator" Runat="server" text='<%#
FormatIsAdministator(DataBinder.Eval(Container.DataItem, "IsAdministator"))
%>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="NewIsAdministator" Runat="server"
CssClass="textbox1">
<asp:ListItem Value="0" Text="No"/>
<asp:ListItem Value="1" Text="Yes"/>
</aspropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
Does anyone know how in EditItemTemplate I can preselect the ListItem in my
DropDownList based on what's currently in the database (0 or 1 for
NewIsAdministator dropdownlist)?
I tried: SelectedIndex = '<%# DataBinder.Eval(Container.DataItem,
"IsAdministator") %>' but that failed
Thank you
Maz.
I have the following code
<asp:TemplateColumn HeaderText="Administator" Visible="True"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Label ID="IsAdministator" Runat="server" text='<%#
FormatIsAdministator(DataBinder.Eval(Container.DataItem, "IsAdministator"))
%>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<aspropDownList ID="NewIsAdministator" Runat="server"
CssClass="textbox1">
<asp:ListItem Value="0" Text="No"/>
<asp:ListItem Value="1" Text="Yes"/>
</aspropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
Does anyone know how in EditItemTemplate I can preselect the ListItem in my
DropDownList based on what's currently in the database (0 or 1 for
NewIsAdministator dropdownlist)?
I tried: SelectedIndex = '<%# DataBinder.Eval(Container.DataItem,
"IsAdministator") %>' but that failed
Thank you
Maz.