Gridview数据手搞乱了帖子后面

时间:2017-07-10 10:40:47

标签: c# asp.net gridview data-binding

我有一个页面,可以发送包含下拉列表和gridview的电子邮件。

我在ddlselectedindexchanged上发布的页面有问题,并且回调oncheckchanged的gridview回复,但回调不起作用。

如果我注释掉gridview.databind,那么回调就可以了。

     <tr>
                                                        <td class="rightalignment">
                                                        <asp:Label ID="lblFacility" runat="server" Text="Facility:"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:DropDownList ID="ddlFacility" OnSelectedIndexChanged="ddlFacility_SelectedIndexChanged"
                                                            AppendDataBoundItems="true" runat="server" AutoPostBack="true">
                                                            <asp:ListItem Selected="True" Text="All" Value="0"></asp:ListItem>
                                                        </asp:DropDownList>
                                                    </td>
                                                </tr>
this is the gridview:
<asp:GridView ID="GvEmail" runat="server" CssClass="tabulardata" AutoGenerateColumns="false"
                                                            AllowPaging="false" GridLines="None" AllowSorting="false" PageSize="100" Width="100%" >
                                                            <Columns>
                                                                <asp:TemplateField ItemStyle-Width="5%" ShowHeader="False">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkselect" runat="server" Checked="true" OnCheckedChanged="chkselect_change"
                                                                            AutoPostBack="true" />
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="LastName" SortExpression="LastName" HeaderText="Last Name"
                                                                    ItemStyle-Width="12%" NullDisplayText="N/A" />
                                                                <asp:BoundField DataField="FirstName" SortExpression="FirstName" HeaderText="First Name"
                                                                    ItemStyle-Width="12%" NullDisplayText="N/A" />

                                                                <asp:TemplateField HeaderText="Email Address" ItemStyle-Width="12%">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lbladdress" runat="server" Text='<%#Eval("EmailAddress") %>'>
                                                                        </asp:Label>
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                            <EmptyDataTemplate>
                                                                <table id="tblRequest" border="1" cellspacing="0" class="tabulardata" rules="all"
                                                                    style="width: 100%; border-collapse: collapse;">
                                                                    <tr>
                                                                        <th scope="col">
                                                                            Last Name
                                                                        </th>
                                                                        <th scope="col">
                                                                            First Name
                                                                        </th>
                                                                        <th scope="col">
                                                                            Email Address
                                                                        </th>
                                                                    </tr>
                                                                    <tr>
                                                                        <td align="center" colspan="4">
                                                                            <strong>No Record Found</strong>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </EmptyDataTemplate>
                                                        </asp:GridView>
代码背后的代码:

protected void Page_Load(object sender, EventArgs e)
    {
        UIUtility.HideMessage(this.Page);
        try
        {


     if (!Page.IsPostBac

k)
            {
                this.GetFacilities(0);


this.GvEmail.DataBind();
        this.GetCorporate();
        this.GetInternalContacts();
        this.GetEmailFrom();
    }
}
catch (Exception ex)
{
        UIUtility.ShowMessage(ex.Message, true, this.Page);
    }

}


    private void GetEmailAddress()
        {
            try
            {
                FacilityBLL = new FacilityBll();
                this.GvEmail.DataSource = FacilityBLL.GetEmailAddressPerCorporateFacility(this.ddlCorporate.SelectedValue, this.ddlFacility.SelectedValue);

            }
            catch (Exception ex)
            {
                UIUtility.ShowMessage(ex.Message, true, this.Page);
            }
        }

1 个答案:

答案 0 :(得分:0)

它在更新面板中。

在评论出更新面板后,我收到了maxhttpkeys被最大化的错误。 我添加到web.config 并且错误已经解决,回拨工作