HOW to persist data with color in dropdownlist control
-
Hi all, I am using asp.net2.0 , C# and sql server 2005. When i fill the dropdownlist with two color based on contdtion in recordset it fill successfully but on seletedindex _change those color vanish but record remains. how can i persist data with color ? the code i used to fill the data is foreach (DataRow row in dtcompany.Rows) { if (row["HM_TRG_FLAG"].Equals(true) ) { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("Tooltip", row[1].ToString()); item.Attributes.Add("style", "color:GREEN"); ctrl.Items.Add(item); //ctrl.Items.Add(new ListItem(ctrl.Items.Add(item);, row[0].ToString())); } else { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("style", "color:RED"); item.Attributes.Add("Tooltip", row[1].ToString()); ctrl.Items.Add(item); } }
regards imran khan
-
Hi all, I am using asp.net2.0 , C# and sql server 2005. When i fill the dropdownlist with two color based on contdtion in recordset it fill successfully but on seletedindex _change those color vanish but record remains. how can i persist data with color ? the code i used to fill the data is foreach (DataRow row in dtcompany.Rows) { if (row["HM_TRG_FLAG"].Equals(true) ) { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("Tooltip", row[1].ToString()); item.Attributes.Add("style", "color:GREEN"); ctrl.Items.Add(item); //ctrl.Items.Add(new ListItem(ctrl.Items.Add(item);, row[0].ToString())); } else { ListItem item = new ListItem(row[1].ToString(), row[0].ToString()); // item.Attributes.Add("style", "color:RED"); item.Attributes.Add("Tooltip", row[1].ToString()); ctrl.Items.Add(item); } }
regards imran khan
Check the default setting of drop downlist remove if drop down list have default settings
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Check the default setting of drop downlist remove if drop down list have default settings
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
i did not get what do you mean by default setting is it viewstate please reply.
regards imran khan