bhavya gadilli bhavya gadilli - 5 months ago 8
Javascript Question

How to make blur an item in drop down if it is already present in gridview

in my application i have two drop downs where in one drop down i need to make blur those days if they are present for particular ddl how can i do this

protected void ddlname_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlname.SelectedItem.Text == "--Select--")
{
lblMessage.Text = "";
grdname.Visible = false;
}
else
{
grdname.Visible = true;
BindGrid();
}
}


here in this event i need to blur the days if they are already given for that batch if not they should be displayed how can i do this

Answer

You have to use dropdownlist databound event and apply your css

<asp:DropDownList ID="DropDownList1"  runat="server"            
 OnDataBound="DropDownList1_DataBound"> </asp:DropDownList>




   protected void DropDownList1_DataBound(object sender, EventArgs e)
   {
    foreach(ListItem myItem in DropDownList1.Items)
    {
          myItem.Attributes.Add("style","background-color:blue"); 
     }
   }
Comments