如何用Javascript操作gridview中的控件
datagrid如下:
asp:GridView ID= "gvDep " runat= "server " AutoGenerateColumns= "False " OnRowCancelingEdit= "gvDep_RowCancelingEdit " OnRowDataBound= "gvDep_RowDataBound " OnRowDeleting= "gvDep_RowDeleting " OnRowEditing= "gvDep_RowEditing " DataKeyNames= "DepID ">
<Columns>
<asp:TemplateField HeaderText= "序号 ">
<EditItemTemplate>
<asp:Label ID= "lbEID " runat= "server " Width= "30px " Text= " <%# Container.DataItemIndex+1 %> "> </asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID= "lbID " runat= "server " Text= " <%# Container.DataItemIndex+1 %> "> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText= "上级部门 ">
<EditItemTemplate>
<asp:TextBox ID= "txtFatherDepName " runat= "server " Width= "93px " Text= ' <%# Bind( "FatherDepName ") %> ' ReadOnly= "True "> </asp:TextBox>
<asp:Button ID= "btnChoise " runat= "server " Text= "选择 " />
<br />
<asp:HiddenField ID= "HiddenField1 " runat= "server " Value= ' <%# Bind( "FatherDepName ") %> ' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID= "lbFatherDepName " runat= "server " Width= "124px " Text= ' <%# Bind( "FatherDepName ") %> '> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton= "True " />
<asp:CommandField ShowDeleteButton= "True " />
</Columns>
</asp:GridView>
现需要用javascript操作TextBox ID= "txtFatherDepName ",那位知道,请指教,谢谢
[解决办法]
document.all.getElementById( "txtFatherDepName ")
[解决办法]
楼上正确
[解决办法]
document.getElementById( "GridView1_ctl02_txtFatherDepName ").value
[解决办法]
顶