在 IE 中工作,在 Firefox 中,这两个字段是空白的,并且名称在 EditUserRoles 分配后未定义:
从gridview调用GetRows,调用editUserRoles
<asp:TemplateField HeaderText="Action">
<ItemTemplate>
<input type="button" id="btnEditUserRoles" style="width:60px;" onclick="GetRows(this.parentNode.parentNode.rowIndex)" value="Edit" />
</ItemTemplate>
</asp:TemplateField>
<input type="text" disabled="disabled" id="txtAkoUserName" />
<input type="text" id="txtUserName" />
function GetRows(index) {
var userGrid = document.getElementById('<%=gridUserRoles.ClientID%>');
EditUserRoles(index, userGrid);
}
function EditUserRoles(rowIndex, userGrid) {
if (null != userGrid) {
var userName = userGrid.rows[rowIndex].cells[0].innerText;
var name = userGrid.rows[rowIndex].cells[1].innerText;
LoadEditForm(userName, name);
}
function LoadEditForm(userName, name) {
$("#txtAkoUserName").val(userName);
$("#txtUserName").val(name);
}