H
Harsha
Hi,
I have a ModalPopupExtender in my page. And In popup I am showing a
gridview. Inside Gridview a dropdownlist is there.
In pop there is a submitt button. But problem is in dropdownlist selected
index remains zero irespective of my selection. Even after I select
second,third or fourth Item ti will show first item of the dropdown as the
selected Item. Please help.
Also, all my code
Please let me know why dropdownlist selected item is not getting changed ?
My Code is as below.
Code to bind gridview in popup window :-
1. protected void btnSearch_Click(object sender, EventArgs e)
2. {
3. DataTable dtContract = new DataTable();
4. dtContract = objBLTimesheet.RunQuery(query);
5.
6.
7. gvOrders.DataSource = dtContract;
8. gvOrders.DataBind();
9. }
And I am binding dropdownlist inside Gridview at RowDataBound Event as below:-
# protected void gvOrders_RowDataBound(object sender, GridViewRowEventArgs
e)
# {
# if (e.Row.RowType == DataControlRowType.DataRow)
# {
# string Ordrno = rw.Cells[0].Text;
# string query = "select MCSRLNO,FOORD from mccommdata";
# DataTable dtmcslorder = new DataTable();
# dtmcslorder = objBLTimesheet.RunQuery(query);
# if (dtmcslorder.Rows.Count > 0)
# {
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataSource = dtmcslorder;
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataTextField = "MCSRLNO";
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataValueField = "FOORD";
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataBind();
#
# }
#
# }
I have a ModalPopupExtender in my page. And In popup I am showing a
gridview. Inside Gridview a dropdownlist is there.
In pop there is a submitt button. But problem is in dropdownlist selected
index remains zero irespective of my selection. Even after I select
second,third or fourth Item ti will show first item of the dropdown as the
selected Item. Please help.
Also, all my code
Please let me know why dropdownlist selected item is not getting changed ?
My Code is as below.
Code to bind gridview in popup window :-
1. protected void btnSearch_Click(object sender, EventArgs e)
2. {
3. DataTable dtContract = new DataTable();
4. dtContract = objBLTimesheet.RunQuery(query);
5.
6.
7. gvOrders.DataSource = dtContract;
8. gvOrders.DataBind();
9. }
And I am binding dropdownlist inside Gridview at RowDataBound Event as below:-
# protected void gvOrders_RowDataBound(object sender, GridViewRowEventArgs
e)
# {
# if (e.Row.RowType == DataControlRowType.DataRow)
# {
# string Ordrno = rw.Cells[0].Text;
# string query = "select MCSRLNO,FOORD from mccommdata";
# DataTable dtmcslorder = new DataTable();
# dtmcslorder = objBLTimesheet.RunQuery(query);
# if (dtmcslorder.Rows.Count > 0)
# {
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataSource = dtmcslorder;
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataTextField = "MCSRLNO";
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataValueField = "FOORD";
#
((DropDownList)rw.FindControl("ddlSlnoOrder")).DataBind();
#
# }
#
# }