gridview后台控件获取问题
现在想通过编辑仓库下拉框,带出所属库位信息。
再仓库选择的事件中,怎么取值和赋值????
省略部分代码
.
.
.
<asp:TemplateField HeaderText="仓库">
<ItemTemplate>
<%# Eval("Warehouse_ID")%>
</ItemTemplate>
<EditItemTemplate>
<asp:HiddenField ID="hck" runat="server" Value='<%# Eval("Warehouse_ID") %>' />
<asp:DropDownList ID="DDLck" runat="server" style="width:80px"
AutoPostBack="True" onselectedindexchanged="DDLck_SelectedIndexChanged" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="库位">
<ItemTemplate>
<%# Eval("Library_ID")%>
</ItemTemplate>
<EditItemTemplate>
<asp:HiddenField ID="hkw" runat="server" Value='<%# Eval("Library_ID") %>' />
<asp:DropDownList ID="DDLkw" runat="server" style="width:80px" />
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField
ShowEditButton="True" CancelText="取消" DeleteText="删除" EditText="修改"
UpdateText="更新" ItemStyle-Width="80px" >
<ItemStyle Width="80px" ForeColor="Black"></ItemStyle>
</asp:CommandField>
</Columns>
<PagerSettings Visible="False" />
</asp:GridView>
后台:
protected void DDLck_SelectedIndexChanged(object sender, EventArgs e)
{
//////库位加载
//DropDownList ddlkw = (DropDownList)gv_InStoreList.HeaderRow.TemplateControl.FindControl("DDLck");
//gv_InStoreList.
////DropDownList ddlck = (DropDownList)gv_InStoreList.TemplateControl.FindControl("DDLck");
////packageStorageBll.LoadPaLibrary(ddlkw, ddlck.SelectedValue);
}
[解决办法]
刚看的:
http://blog.csdn.net/21aspnet/article/details/1540301, ---72 绝技
[解决办法]
/*联动表单*/// 在DropDownList的onchange实践里写所属库的信息绑定到要显示的地方// dropdownlist 有text和value 2个属性 text是能看到的 value是看不到的
[解决办法]
关键要把GridView的行号作为参数传入事件中,然后联动就可以了!