|
-
February 2nd, 2007, 03:03 AM
#1
[RESOLVED] DropDownList data rebind
Hello,
In my GridView I have two related columns: "Project Name" and "SubProject Name". Each column is a template column with a DropDownList. For each row, I want the SubProject ddl to show only subprojects of the Project selected in Project ddl in that specific row.
All these ddl's are shown only in edit mode. So here is my code for RowEditing event:
protected void grdHoursReport_RowEditing(object sender, GridViewEditEventArgs e)
{
grdHoursReport.EditIndex = e.NewEditIndex;
DataBind();
DropDownList projects =
(DropDownList)grdHoursReport.Rows[e.NewEditIndex].Cells[5].FindControl("ddlProjectID");
DropDownList subProjects =
(DropDownList)grdHoursReport.Rows[e.NewEditIndex].Cells[6].FindControl("ddlSubProjectID");
SubProjectsDataSource.FilterExpression = "ProjID = " + projects.SelectedValue;
subProjects.DataSource = SubProjectsDataSource.Select(DataSourceSelectArguments.Empty);
subProjects.DataTextField = "SubProjName";
subProjects.DataValueField = "SubProjID";
subProjects.DataBind();
}
So the SubProjects ddl is unbound by default, and when the user wants to edit a row, I bind the ddl to data source with appropriate filtering (by ID of the project selected in Projects ddl) - using the code above.
Now... that doesn't work. I've put a breakpoint there, and I've noticed that the subProjects ddl is filled with all the appropriate values. But I don't see these values in the browser - the ddl stays unbound there. I understand that the problem is that all the binding is performed on server-side, and there is no postback, so I can't see the result in my browser. Is that the reason? How can I correct this?
(Tried to put the ddl inside an AJAX update panel - didn't help...)
-
February 2nd, 2007, 03:39 AM
#2
Re: DropDownList data rebind
-
February 2nd, 2007, 09:34 AM
#3
Re: DropDownList data rebind
In that case, you might want to mark this thread as resolved by clicking the Thread Tools menu and then Mark Thread resolved.
-
February 2nd, 2007, 09:41 AM
#4
Re: DropDownList data rebind
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|