plz plz plz......help me
Hi guys i have a problem with DataGrid in .Net1.1
can anybody help me plz.....very urgent....
I have a datagrid containing 2 columns. In one column the values are displayed by binding datafield.the other column is template column which contains dropdownlist.
I need to enable dropdownlist only if the value in column1 matches some condition. I hard coded the values in DDl
Column1 Column2
red Enable DDL
red Enable DDL
blue Disable DDL
white Disable DDL
red Enable DDL
blue Disable DDL
i have written the following code:
<asp:BoundColumn DataField="Column1" HeaderText="Column1">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Column2">
<ItemStyle HorizontalAlign="Center"VerticalAlign="Middle"></ItemStyle>
<ItemTemplate>
<P>
<asp:DropDownList id="Column2DDL" Runat="server" Enabled='<%# GetDDLSetting(DataBinder.Eval(Container, "DataItem.Column1")) %>'>
<asp:ListItem Value="--Select--">--Select--</asp:ListItem>
<asp:ListItem Value="Good">1st degree</asp:ListItem>
<asp:ListItem Value="Average">5 degree</asp:ListItem>
<asp:ListItem Value="Poor">10 degree</asp:ListItem>
</asp:DropDownList></P>
</ItemTemplate>
</asp:TemplateColumn>
in the code behind i had a function
protected bool GetDDLSetting(object myobj)
{
if(myobj.ToString()=="red")
{
return true;
}
else
{
return false;
}
}
the function is getting compiled but my DDL is not getting enabled if the value in column1 is equal to red.
please help me.......very urgent need.....i have a dead line.......plz guys.....
Very Thanks in advance!!!!!!
|