if (ds.Tables[0].Rows.Count > 0)
{
dr = ds.Tables[0].NewRow();
dr[0] = 0;
dr[1] = "Select";
ds.Tables[0].Rows.InsertAt(dr, 0);
for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
{
ListItem item = new ListItem();
item.Value = ds.Tables[0].Rows[i]["sc_code"].ToString();
item.Text = ds.Tables[0].Rows[i]["sc_desc"].ToString();
item.Attributes.Add("active_yn", ds.Tables[0].Rows[i]["sc_active_yn"].ToString());
ddlCity.Items.Add(item);
}
if (ddlCity.Items.Count > 0)
{
for (int j = 0; j < ddlCity.Items.Count; j++)
{
if (ddlCity.Items[j].Attributes["active_yn"].ToString() == "N")
{
ddlCity.Items[j].Attributes.Add("style", "color:red");
}
}
}
}
{
dr = ds.Tables[0].NewRow();
dr[0] = 0;
dr[1] = "Select";
ds.Tables[0].Rows.InsertAt(dr, 0);
for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
{
ListItem item = new ListItem();
item.Value = ds.Tables[0].Rows[i]["sc_code"].ToString();
item.Text = ds.Tables[0].Rows[i]["sc_desc"].ToString();
item.Attributes.Add("active_yn", ds.Tables[0].Rows[i]["sc_active_yn"].ToString());
ddlCity.Items.Add(item);
}
if (ddlCity.Items.Count > 0)
{
for (int j = 0; j < ddlCity.Items.Count; j++)
{
if (ddlCity.Items[j].Attributes["active_yn"].ToString() == "N")
{
ddlCity.Items[j].Attributes.Add("style", "color:red");
}
}
}
}
No comments:
Post a Comment