如何在网格视图中的控件中使用更新面板. [英] How to use Update Panel for the control in the gridview.

查看:92
本文介绍了如何在网格视图中的控件中使用更新面板.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的更新面板有问题,请帮助我解决此问题,
问题是,我有一个gridview,其中一个文本框控件的autopostback设置为true,而更新面板则设置为整个页面.当我单击外部的提交按钮时,gridview页面没有刷新,这意味着更新面板正在工作.并且当gridview激发页面中的文本框控件正在刷新时,它不应该刷新(更新面板在这里不起作用)..帮助我如何解决此问题..

我的代码就是这样..

Hello everyone,

I have an issue with update panel, please help me to solve this issue,
Problem is, I have a gridview in that a textbox control with autopostback set true and an update panel to whole page. when i click on the submit button out side the gridview page is not refreshing, that means update panel working,. and when the textbox control in gridview fires page is refreshing, which it should not refresh(update panel is not working here).. help me how solve this issue..

my code is something like this..

<asp:UpdatePanel ID="UpdatePanel1" runat="server">        
<ContentTemplate>
asp:GridView ID="gVAppraisal" runat="server" AutoGenerateColumns="False"
<Columns>
<asp:TemplateField HeaderText="Manager" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox ID="txtWT" runat="server" Width="30px" AutoPostBack="true"                                                           OnTextChanged="txtWT_TextChanged"></asp:TextBox>%                                            <asp:RequiredFieldValidator ID="RFTH" runat="server" ControlToValidate="txtWT" ValidationGroup="save" Display="Dynamic" ForeColor="Red" ErrorMessage="Please Enter the missed percentages, check at the red colored star symbol">*</asp:RequiredFieldValidator>                                           </ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="btnSave" runat="server" CssClass="button" OnClick="btnSave_Click"

Text="Save" ValidationGroup="save" ToolTip="Save" />
</ContentTemplate>
</asp:UpdatePanel>



在此先感谢...



Thanks in advance...

推荐答案

使用此

Use this

<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
        asp:GridView ID="gVAppraisal" runat="server" AutoGenerateColumns="False"
        <columns>
<asp:TemplateField HeaderText="Manager" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox ID="txtWT" runat="server" Width="30px" AutoPostBack="true"                                                           OnTextChanged="txtWT_TextChanged"></asp:TextBox>%                                            <asp:RequiredFieldValidator ID="RFTH" runat="server" ControlToValidate="txtWT" ValidationGroup="save" Display="Dynamic" ForeColor="Red" ErrorMessage="Please Enter the missed percentages, check at the red colored star symbol">*</asp:RequiredFieldValidator>                                           </ItemTemplate>
</asp:TemplateField>
</columns>
        </asp:GridView>
        <asp:Button ID="btnSave" runat="server" CssClass="button" OnClick="btnSave_Click"

            Text="Save" ValidationGroup="save" ToolTip="Save" />
    </ContentTemplate>
        <Triggers>

<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />

            </Triggers>
</asp:UpdatePanel>


尝试以下代码.将您的文本框保留在更新面板中
try the following code. keep your textbox in update panel
<asp:TemplateField>
        <ItemTemplate>
            <asp:UpdatePanel runat="server">
                 <ContentTemplate>
                    <asp:TextBox ID="txtTestGrid" runat="server" AutoPostBack="True"

                                   ontextchanged="txtTestGrid_TextChanged"></asp:TextBox>
                  </ContentTemplate>
            </asp:UpdatePanel>
        </ItemTemplate>
</asp:TemplateField


这篇关于如何在网格视图中的控件中使用更新面板.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆