[英]How to get value in drop down-list from parent Grid-view when Click Edit on child grid-view?
I have nested grid-view. 我有嵌套的网格视图。 In Parent grid View when I Click to Expand the gridview the child gridview shows the related data.
在父网格视图中,当我单击以展开网格视图时,子网格视图将显示相关数据。 But when I click to Edit Child grid view The values go to textbox outside the gridview but not in dropdown list.
但是,当我单击“编辑子网格”视图时,这些值将转到网格视图外部的文本框,但不在下拉列表中。
I have tried 我努力了
protected void gvSub_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView gvSub = sender as GridView;
GridViewRow row = gvSub.Rows[e.NewEditIndex];
Int32 a = Convert.ToInt32(gvSub.DataKeys[e.NewEditIndex][0]);
TextBox1.Text = ((Label)row.FindControl("lblName")).Text;
TextBox2.Text = ((Label)row.FindControl("lblPrice")).Text;
TextBox3.Text = ((Label)row.FindControl("qty")).Text;
String Cate = ((Label)gvSub.Parent.FindControl("lblCtName")).Text;
DropDownList1.Items.FindByValue(Cate.ToString()).Selected = true;
btnSub.Text = "Update";
e.Cancel = true;
}
Parent Gridview Value fetched in Cate but not getting in dropdownlist 父Gridview值在Cate中获取,但未在下拉列表中获取
将“ DropDownList1.Items.FindByValue”更改为“ DropDownList1.Items.Add”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.