本文介绍了使用oncheckedchanged在网格和更新面板中滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我在更新面板中使用带有复选框的网格视图。它工作得很好。但问题是当选中复选框时滚动正在上升。滚动在网格内部而不是页面。我只想保持网格内的滚动位置,并在选择网格后获得一些值。发回后卷轴上升。我怎么能解决这个问题..谢谢 我试过这个 我尝试过: < script src =Scripts / jquery-1.4.1.min.jstype = text / javascript>< / script> < script src =Scripts / ScrollableGridViewPlugin_ASP.NetAJAXmin.jstype =text / javascript>< / script> < script type =text / javascript> $(document).ready(function(){ $('#<%= grvBCLList.ClientID%>')。可滚动({ ScrollHeight:300, IsInUpdatePanel:true }); }); < / script> < asp:ScriptManager ID =ScriptManager1runat =serverScriptMode =Release> < asp:UpdatePanel ID =UpdatePanel1runat =server> < contenttemplate> <% - - %> < asp:GridView ID =grvBCLListrunat =serverHeight =60pxWidth =1600px AutoGenerateColumns =FalseCellPadding =4CssClass =style31 ForeColor =#333333GridLines =None> < alternatingrowstyle backcolor =White> < columns> < asp:BoundField DataField =sTranNoHeaderText =PRCN NumberSortExpression =sTranNo/> < asp:BoundField DataField =rcpnoHeaderText =RMS-RcptnoSortExpression =rcpno/> < asp:BoundField DataField =dtDateTimeHeaderText =PRCN日期DataFormatString ={0:d}SortExpression =dtDateTime/> < asp:BoundField DataField =sVendorIDHeaderText =Farmer NRC NumberSortExpression =sVendorID/> < asp:BoundField DataField =sVendorNameHeaderText =农民姓名 HeaderStyle-Width =150pxSortExpression =sVendorName> < HeaderStyle Width =150px>< / HeaderStyle> < asp:BoundField DataField =sLocHeaderText =Satalite DepotSortExpression =sLoc/> < ASP:BoundFiel d DataField =sItemNoHeaderText =裁剪代码 HeaderStyle-Width =100pxSortExpression =sItemNo> < HeaderStyle Width =100px >< / HeaderStyle> < asp:BoundField DataField =sItemDescrHeaderText =裁剪名称 HeaderStyle-Width =200pxSortExpression =sItemDescr> < HeaderStyle Width =200px>< / HeaderStyle> < asp:BoundField DataField =sUOMHeaderText =UnitSortExpression =sUOM/> < asp:BoundField DataField =dUnitCostHeaderText =Item PriceSortExpression = dUnitCost/> < asp:BoundField DataField =dQtyReceivedActualHeaderText =收到的行李SortExpression =dQtyReceivedActual/> < asp:BoundField DataField =dDocTotalHeaderText =Crop ValueSortExpression =dDocTotal/> < asp:TemplateField HeaderText =Verified> <% - < edititemtemplate> < asp:CheckBox ID =chkSelectrunat =serverOnCheckedChanged =ChkSelect_ChangedAutoPostBack =true/> - %> < itemtemplate> < asp:CheckBox ID =cbVerifiedrunat =serverAutoPostBack =true oncheckedchanged =cbVerified_CheckedChanged/> < editrowstyle backcolor =#7C6F57> < footerstyle backcolor =#1C5E55font-bold =Truefore color =White> < HeaderStyle BackColor =#1C5E55Font-Bold =TrueForeColor =White/> < pagerstyle backcolor =#666666forecolor =Whitehorizo​​ntalalign =Center> < rowstyle backcolor =#E3EAEB> < SelectedRowStyle BackColor = #C5BBAFFont-Bold =TrueForeColor =#333333/> < sortedascendingcellstyle backcolor =#F8FAFA> < sortedascendingheaderstyle backcolor =#246B61> < sorteddescendingcellstyle backcolor =#D4DFE1> < sorteddescendingheaderstyle backcolor =#15524A> < asp:TextBox ID =txtSelPCRNTotalrunat =server Enabled =falsestyle =text-align:right> <% - - %><% - - %> < asp:Label ID =lbl_testrunat =server> 解决方案 (document).ready(function(){ ('#<%= grvBCLList.ClientID%>')。可滚动({ ScrollHeight:300, IsInUpdatePanel:true }); }); < / script> < asp:ScriptManager ID =ScriptManager1runat =serverScriptMode =Release> < asp:UpdatePanel ID =UpdatePanel1runat =server> < contenttemplate> <% - - %> < asp:GridView ID =grvBCLListrunat =serverHeight =60pxWidth =1600px AutoGenerateColumns =FalseCellPadding =4CssClass = style31 ForeColor =#333333GridLines =None> < alternatingrowstyle backcolor =White> < columns> < asp:BoundField DataField =sTranNoHeaderText =PRCN NumberSortExpression =sTranNo/> < asp:BoundField DataField =rcpnoHeaderText =RMS-RcptnoSortExpression =rcpno/> < asp:BoundField DataField =dtDateTimeHeaderText =PRCN日期DataFormatString ={0:d}SortExpression =dtDateTime/> < asp:BoundField DataField =sVendorIDHeaderText =Farmer NRC NumberSortExpression =sVendorID/> < asp:BoundField DataField =sVendorNameHeaderText =农民姓名 HeaderStyle-Width =150pxSortExpression =sVendorName> < HeaderStyle Width =150px>< / HeaderStyle> < asp:BoundField DataField =sLocHeaderText =Satalite DepotSortExpression =sLoc/> < ASP:BoundFiel d DataField =sItemNoHeaderText =裁剪代码 HeaderStyle-Width =100pxSortExpression =sItemNo> < HeaderStyle Width =100px >< / HeaderStyle> < asp:BoundField DataField =sItemDescrHeaderText =裁剪名称 HeaderStyle-Width =200pxSortExpression =sItemDescr> < HeaderStyle Width =200px>< / HeaderStyle> < asp:BoundField DataField =sUOMHeaderText =UnitSortExpression =sUOM/> < asp:BoundField DataField =dUnitCostHeaderText =Item PriceSortExpression = dUnitCost/> < asp:BoundField DataField =dQtyReceivedActualHeaderText =收到的行李SortExpression =dQtyReceivedActual/> < asp:BoundField DataField =dDocTotalHeaderText =Crop ValueSortExpression =dDocTotal/> < asp:TemplateField HeaderText =Verified> <% - < edititemtemplate> < asp:CheckBox ID =chkSelectrunat =serverOnCheckedChanged =ChkSelect_ChangedAutoPostBack =true/> - %> < itemtemplate> < asp:CheckBox ID =cbVerifiedrunat =serverAutoPostBack =true oncheckedchanged =cbVerified_CheckedChanged/> < editrowstyle backcolor =#7C6F57> < footerstyle backcolor =#1C5E55font-bold =Truefore color =White> < HeaderStyle BackColor =#1C5E55Font-Bold =TrueForeColor =White/> < pagerstyle backcolor =#666666forecolor =Whitehorizo​​ntalalign =Center> < rowstyle backcolor =#E3EAEB> < SelectedRowStyle BackColor = #C5BBAFFont-Bold =TrueForeColor =#333333/> < sortedascendingcellstyle backcolor =#F8FAFA> < sortedascendingheaderstyle backcolor =#246B61> < sorteddescendingcellstyle backcolor =#D4DFE1> < sorteddescendingheaderstyle backcolor =#15524A> < asp:TextBox ID =txtSelPCRNTotalrunat =server Enabled =falsestyle =text-align:right> <% - - %><% - - %> < asp:标签ID =lbl_testrunat =server> 使用 scrollTop [ ^ ]在回发之前捕获滚动条位置并暂时保存在隐藏字段中, 一旦发生回发并在脚本的最后部分使用 Jquery加载函数 /> < script> I am using a grid view with a check box inside update panel . it is working perfectly. but the problem is when the check box is selected the scroll is going up. the scroll is inside the grid not for the page. i just want to maintain the scroll position inside grid and also get some value after selecting the grid. after post back the scroll going up . how i can solve this.. Thank youI tried thisWhat I have tried:<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script><script src="Scripts/ScrollableGridViewPlugin_ASP.NetAJAXmin.js" type="text/javascript"></script><script type="text/javascript"> $(document).ready(function () { $('#<%=grvBCLList.ClientID %>').Scrollable({ ScrollHeight:300, IsInUpdatePanel: true }); }); </script> <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <%-- --%> <asp:GridView ID="grvBCLList" runat="server" Height="60px" Width="1600px" AutoGenerateColumns="False" CellPadding="4" CssClass="style31" ForeColor="#333333" GridLines="None"> <alternatingrowstyle backcolor="White"> <columns> <asp:BoundField DataField="sTranNo" HeaderText="PRCN Number" SortExpression="sTranNo" /> <asp:BoundField DataField="rcpno" HeaderText="RMS-Rcptno" SortExpression="rcpno" /> <asp:BoundField DataField="dtDateTime" HeaderText="PRCN Date" DataFormatString="{0:d}" SortExpression="dtDateTime" /> <asp:BoundField DataField="sVendorID" HeaderText="Farmer NRC Number" SortExpression="sVendorID" /> <asp:BoundField DataField="sVendorName" HeaderText="Farmer Name" HeaderStyle-Width="150px" SortExpression="sVendorName" > <HeaderStyle Width="150px"></HeaderStyle> <asp:BoundField DataField="sLoc" HeaderText="Satalite Depot" SortExpression="sLoc" /> <asp:BoundField DataField="sItemNo" HeaderText=" Crop Code " HeaderStyle-Width="100px" SortExpression="sItemNo" > <HeaderStyle Width="100px"></HeaderStyle> <asp:BoundField DataField="sItemDescr" HeaderText="Crop Name" HeaderStyle-Width="200px" SortExpression="sItemDescr" > <HeaderStyle Width="200px"></HeaderStyle> <asp:BoundField DataField="sUOM" HeaderText="Unit" SortExpression="sUOM" /> <asp:BoundField DataField="dUnitCost" HeaderText="Item Price" SortExpression="dUnitCost" /> <asp:BoundField DataField="dQtyReceivedActual" HeaderText="Bags Received" SortExpression="dQtyReceivedActual" /> <asp:BoundField DataField="dDocTotal" HeaderText="Crop Value" SortExpression="dDocTotal" /> <asp:TemplateField HeaderText="Verified"> <%-- <edititemtemplate> <asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged="ChkSelect_Changed" AutoPostBack="true" /> --%> <itemtemplate> <asp:CheckBox ID="cbVerified" runat="server" AutoPostBack="true" oncheckedchanged="cbVerified_CheckedChanged"/> <editrowstyle backcolor="#7C6F57"> <footerstyle backcolor="#1C5E55" font-bold="True" forecolor="White"> <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <pagerstyle backcolor="#666666" forecolor="White" horizontalalign="Center"> <rowstyle backcolor="#E3EAEB"> <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /> <sortedascendingcellstyle backcolor="#F8FAFA"> <sortedascendingheaderstyle backcolor="#246B61"> <sorteddescendingcellstyle backcolor="#D4DFE1"> <sorteddescendingheaderstyle backcolor="#15524A"> <asp:TextBox ID="txtSelPCRNTotal" runat="server" Enabled="false" style="text-align:right"> <%----%><%-- --%> <asp:Label ID="lbl_test" runat="server"> 解决方案 (document).ready(function () {('#<%=grvBCLList.ClientID %>').Scrollable({ ScrollHeight:300, IsInUpdatePanel: true }); }); </script> <asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Release"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <contenttemplate> <%-- --%> <asp:GridView ID="grvBCLList" runat="server" Height="60px" Width="1600px" AutoGenerateColumns="False" CellPadding="4" CssClass="style31" ForeColor="#333333" GridLines="None"> <alternatingrowstyle backcolor="White"> <columns> <asp:BoundField DataField="sTranNo" HeaderText="PRCN Number" SortExpression="sTranNo" /> <asp:BoundField DataField="rcpno" HeaderText="RMS-Rcptno" SortExpression="rcpno" /> <asp:BoundField DataField="dtDateTime" HeaderText="PRCN Date" DataFormatString="{0:d}" SortExpression="dtDateTime" /> <asp:BoundField DataField="sVendorID" HeaderText="Farmer NRC Number" SortExpression="sVendorID" /> <asp:BoundField DataField="sVendorName" HeaderText="Farmer Name" HeaderStyle-Width="150px" SortExpression="sVendorName" > <HeaderStyle Width="150px"></HeaderStyle> <asp:BoundField DataField="sLoc" HeaderText="Satalite Depot" SortExpression="sLoc" /> <asp:BoundField DataField="sItemNo" HeaderText=" Crop Code " HeaderStyle-Width="100px" SortExpression="sItemNo" > <HeaderStyle Width="100px"></HeaderStyle> <asp:BoundField DataField="sItemDescr" HeaderText="Crop Name" HeaderStyle-Width="200px" SortExpression="sItemDescr" > <HeaderStyle Width="200px"></HeaderStyle> <asp:BoundField DataField="sUOM" HeaderText="Unit" SortExpression="sUOM" /> <asp:BoundField DataField="dUnitCost" HeaderText="Item Price" SortExpression="dUnitCost" /> <asp:BoundField DataField="dQtyReceivedActual" HeaderText="Bags Received" SortExpression="dQtyReceivedActual" /> <asp:BoundField DataField="dDocTotal" HeaderText="Crop Value" SortExpression="dDocTotal" /> <asp:TemplateField HeaderText="Verified"> <%-- <edititemtemplate> <asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged="ChkSelect_Changed" AutoPostBack="true" /> --%> <itemtemplate> <asp:CheckBox ID="cbVerified" runat="server" AutoPostBack="true" oncheckedchanged="cbVerified_CheckedChanged"/> <editrowstyle backcolor="#7C6F57"> <footerstyle backcolor="#1C5E55" font-bold="True" forecolor="White"> <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" /> <pagerstyle backcolor="#666666" forecolor="White" horizontalalign="Center"> <rowstyle backcolor="#E3EAEB"> <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" /> <sortedascendingcellstyle backcolor="#F8FAFA"> <sortedascendingheaderstyle backcolor="#246B61"> <sorteddescendingcellstyle backcolor="#D4DFE1"> <sorteddescendingheaderstyle backcolor="#15524A"> <asp:TextBox ID="txtSelPCRNTotal" runat="server" Enabled="false" style="text-align:right"> <%----%><%-- --%> <asp:Label ID="lbl_test" runat="server">use scrollTop [^] to capture the scroll bar position before doing the post back and save it temporarily in a hidden field,once the postback is happened and using Jquery load function at the last part of your script<script> 这篇关于使用oncheckedchanged在网格和更新面板中滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-06 19:55