Hi,
i am using asp.net cascadiung dropdown
lists.
assignment
2.task
i have bind data to both dropdownlist and succesfully write insert code.
But my problem is when i next time go that page grid must show previously inserted data.
For this i can able to bind assignment dropdown but my task dropdown is not binding properly.
It shows all data for that current assignment(not showing which task is allready inserted for that
assignment.)
i tried following code for assignment
and task binding.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType ==DataControlRowType.DataRow)
{
DropDownList ddlAssignment = (e.Row.FindControl("ddlAssignment") as DropDownList);
string Assignment =(e.Row.FindControl("lblAssignment") as Label).Text;
ddlAssignment.ClearSelection();
ddlAssignment.Items.FindByText(Assignment).Selected = true;
DropDownList ddlTask = (e.Row.FindControl("ddlTask") as DropDownList);
string Task = (e.Row.FindControl("lblTask") as Label).Text;
ddlTask.ClearSelection();
ddlTask.Items.FindByText(Task).Selected = true;
i also tried
ddlTask.Items.FindByValue(Task).Selected = true;
}
}
Thanks.
i am using asp.net cascadiung dropdown
lists.
assignment
2.task
i have bind data to both dropdownlist and succesfully write insert code.
But my problem is when i next time go that page grid must show previously inserted data.
For this i can able to bind assignment dropdown but my task dropdown is not binding properly.
It shows all data for that current assignment(not showing which task is allready inserted for that
assignment.)
i tried following code for assignment
and task binding.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType ==DataControlRowType.DataRow)
{
DropDownList ddlAssignment = (e.Row.FindControl("ddlAssignment") as DropDownList);
string Assignment =(e.Row.FindControl("lblAssignment") as Label).Text;
ddlAssignment.ClearSelection();
ddlAssignment.Items.FindByText(Assignment).Selected = true;
DropDownList ddlTask = (e.Row.FindControl("ddlTask") as DropDownList);
string Task = (e.Row.FindControl("lblTask") as Label).Text;
ddlTask.ClearSelection();
ddlTask.Items.FindByText(Task).Selected = true;
i also tried
ddlTask.Items.FindByValue(Task).Selected = true;
}
}
Thanks.