-1
我從here取得了代碼並在我的項目中實現,問題是它在IE中正常工作。但不工作的CHROMEGridView的可編輯文本框在Chrome中不工作
這裏是我的代碼: -
<cc1:Grid ID="GrdConfirmation" EnableTypeValidation="true" runat="server" Width="100%"
ShowFooter="false" AllowAddingRecords="true" AllowSorting="false" AutoGenerateColumns="false"
FolderStyle="../Styles/Grid/style_12">
<ClientSideEvents OnClientSelect="GrdConfirmation_OnClientSelect" />
<Columns>
<cc1:Column ID="Column1" DataField="MKEY" HeaderText="Select" ReadOnly="true" Width="3%"
runat="server">
<TemplateSettings TemplateId="gtchkConfirm" HeaderTemplateId="HTConfirm" />
</cc1:Column>
<cc1:Column ID="Sr_No" DataField="Sr_No" HeaderText="Sr No" Visible="false" Width="0%">
<TemplateSettings TemplateId="tplNumbering" />
</cc1:Column>
<cc1:Column ID="col_save_srno" DataField="save_srno" HeaderText="Sr.No" Visible="true"
Width="3%" Align="left">
</cc1:Column>
<cc1:Column ID="Line_Id" DataField="Line_Id" HeaderText="Line id" Visible="false"
Align="left" Width="0%">
</cc1:Column>
<cc1:Column ID="Item_Mkey" DataField="Item_Mkey" HeaderText="Item Mkey" Visible="false"
Align="center" Width="0%">
</cc1:Column>
<cc1:Column ID="Item_Code" DataField="Item_Code" HeaderText="Item Code" Visible="true"
Align="left" Width="5%">
</cc1:Column>
<cc1:Column ID="Item_Desc" DataField="Item_Desc" HeaderText="Item Description" Visible="true"
Align="left" Width="13%" Wrap="true" HeaderStyle-Wrap="true">
</cc1:Column>
<cc1:Column ID="Lot_Batch_No" DataField="Lot_Batch_No" HeaderText="Lot/Batch No."
Visible="true" Align="left" Width="7%" Wrap="true">
</cc1:Column>
<cc1:Column ID="Exp_Dt" DataField="Exp_Dt" HeaderText="Exp Date" Visible="true" Align="left"
Width="7%" Wrap="true">
</cc1:Column>
<cc1:Column ID="QTY1" DataField="Qty" HeaderText=" Quantity" Visible="true" Width="6%"
Align="center">
</cc1:Column>
<cc1:Column ID="Bx_Bg" DataField="Bx_Bg" HeaderText="Boxes/Bags" Visible="true" Width="6%"
Align="center">
</cc1:Column>
<cc1:Column ID="Net_Wgt" DataField="Net_Wgt" HeaderText="Net Weight" Visible="true" HeaderAlign="center"
Width="6%" Align="center">
</cc1:Column>
<cc1:Column ID="NO_OF_PALLETS" DataField="NO_OF_PALLETS" HeaderText="No Of Pallets" HeaderAlign="center"
Visible="true" Align="center" Width="5%" Wrap="true">
</cc1:Column>
<cc1:Column ID="Default_Allot" DataField="Default_Allot" HeaderText="Allocated Storage Bin No."
Visible="true" Width="10%" Align="center" Wrap="true">
</cc1:Column>
<cc1:Column ID="Confirmed_Allot" DataField="Confirmed_Allot" HeaderText="Confirmed Storage Bin No."
Visible="true" Width="10%" Align="center" Wrap="true">
<TemplateSettings TemplateId="PlainEditTemplate" />
</cc1:Column>
<cc1:Column ID="Storage_type" DataField="Storage_type" HeaderText="Storage Type"
Visible="false" Width="0%" Align="center" Wrap="true">
</cc1:Column>
<cc1:Column ID="Damaged_Qty" DataField="Damaged_Qty" HeaderText="Damaged Qty in Units"
Visible="true" Width="5%" Align="center" Wrap="true">
<TemplateSettings TemplateId="PlainEditTemplate" />
</cc1:Column>
<cc1:Column ID="Short_Fall_Excess" DataField="Short_Fall_Excess" HeaderText="Shortfall/ excess qty in units"
Visible="true" Width="5%" Align="center" Wrap="true">
<TemplateSettings TemplateId="PlainEditTemplate" />
</cc1:Column>
</Columns>
<Templates>
<cc1:GridTemplate runat="server" ID="PlainEditTemplate">
<Template>
<asp:TextBox runat="server" ID="txtconfirm" CssClass="excel-textbox" onfocus="markAsFocused(this)"
onblur="markAsBlured(this)" />
</Template>
</cc1:GridTemplate>
</Templates>
<AddEditDeleteSettings AddLinksPosition="Bottom" NewRecordPosition="Dynamic" />
<Templates>
<cc1:GridTemplate runat="server" ID="GridTemplate1">
<Template>
<input id="txttemp" type="text" />
</Template>
</cc1:GridTemplate>
</Templates>
<Templates>
<cc1:GridTemplate runat="server" ID="HTConfirm">
<Template>
<input type="checkbox" onclick="toggleSelection(this)" id="ChkSelector" />
</Template>
</cc1:GridTemplate>
<cc1:GridTemplate runat="server" ID="gtchkConfirm">
<Template>
<asp:CheckBox ID="chk_grid" runat="server" />
</Template>
</cc1:GridTemplate>
</Templates>
<Templates>
<cc1:GridTemplate runat="server" ID="TextBoxEditTemplate">
<Template>
<input type="text" name="TextBox1111" id="Txtconfirm<%# (Container.RecordIndex) %>"
class="excel-textbox" readonly="readonly" onfocus="GrdConfirmation.editWithTextBox(this)" />
</Template>
</cc1:GridTemplate>
<cc1:GridTemplate runat="server" ID="tplNumbering">
<Template>
<b>
<%# (Container.RecordIndex + 1)%>
</b>
</Template>
</cc1:GridTemplate>
<cc1:GridTemplate ID="TemplateWithCheckbox">
<Template>
<asp:CheckBox runat="server" ID="ChkID" ToolTip="<%# Container.Value %>" />
</Template>
</cc1:GridTemplate>
</Templates>
</cc1:Grid>
下面是相關的,我實現
function toggleSelection(checkbox) {
var con = confirm("Do you want check/unckeck all");
if (con == true) {
for (var ii = 0; ii < GrdConfirmation.getTotalNumberOfRecords(); ii++) {
var idt = "GrdConfirmation_ob_GrdConfirmationBodyContainer_ctl34_" + ii + "_ctl00_" + ii + "_txtconfirm_" + ii;
var idc = "GrdConfirmation_ob_GrdConfirmationBodyContainer_ctl02_" + ii + "_ctl00_" + ii + "_chk_grid_" + ii;
if (document.getElementById(checkbox.id).checked == true) {
document.getElementById(idt).value = GrdConfirmation.Rows[ii].Cells[13].Value;
// alert(GrdConfirmation.Rows[ii].Cells[13].Value);
document.getElementById(idc).checked = true;
}
else {
document.getElementById(idt).value = "";
document.getElementById(idc).checked = false;
}
}
}
}
我試着調試中Console
我的代碼和下面的JavaScript函數即將出現的錯誤截圖。
錯誤是
無法加載資源:服務器與404(未找到)
什麼沒有被發現?請不要提供錯誤的圖片,請粘貼文本,或在圖片中包含完整的錯誤。 –
@HanletEscaño:實際上頁面上沒有**錯誤**,唯一的問題是這個功能在'chrome'中不起作用 – BNN
它尋找的資源不可用,或者您應該將資源放在相同的位置放置或刪除您使用此資源的任何地方。 –