0

我在更新面板中有一个网格视图,其中包含多个绑定字段最后两个绑定字段如图所示,当单击显示另一个没有回发的网格视图但下载不起作用除了我设置脚本管理器的 EnablePartialRendering="false" 但在这种情况下更新面板无法显示绑定字段

在此处输入图像描述

    <asp:ScriptManager ID="ScriptManager1"  runat="server">  
 </asp:ScriptManager>  
 <asp:UpdatePanel ID="UpdatePanel1" runat="server" >  
<contenttemplate>  

 <div id="DivImages" runat="server" visible="false" class="block rnd">
            <div class="title2">الأحكـــــــــــام</div>
            <div class="content2">

     <asp:gridview ID="GvImages" runat="server"  PagerStyle-CssClass="pages"   AllowPaging="True" 
                        AutoGenerateColumns="False" CellSpacing="-1" Width="100%" DataKeyNames="DocCode,IssuesID" 
       CssClass="dataGrid"   OnPageIndexChanging="GvImages_PageIndexChanging" GridLines="None" 
                        PageSize="20" OnRowCommand="GvImages_RowCommand" 
                        OnSelectedIndexChanging="GvImages_SelectedIndexChanging">
<AlternatingRowStyle BackColor="White" />
<Columns>

<asp:TemplateField HeaderText="رقم السجــل">   
     <ItemTemplate>
             <%# Container.DataItemIndex + 1 %>   
     </ItemTemplate>
 </asp:TemplateField>


 <asp:BoundField DataField="DocCode" HeaderText="رقم الحكم/ القرار"   SortExpression="DocCode" />
    <asp:BoundField DataField="IssuesNum" HeaderText="كود القضيه" 
        SortExpression="IssuesNum" />
                <asp:BoundField DataField="TypeName" HeaderText="نوع القضيه" 
        SortExpression="TypeName" />
         <asp:BoundField DataField="Year" HeaderText="السنه" 
        SortExpression="Year" />

            <asp:BoundField DataField="Area" HeaderText="المنطقه" 
        SortExpression="Area" />



      <asp:BoundField DataField="DocTypeName" HeaderText="تصنيــف المستند" SortExpression="DocTypeName" />

    <asp:BoundField DataField="Name" HeaderText="نوع المستند" 
        SortExpression="Name" />

            <asp:TemplateField  HeaderText="حذف">

                            <ItemTemplate>
                                <asp:LinkButton ID="cmd_DeleteRow"   CommandName="DeleteRow"  CssClass="delete" ToolTip="حذف" CommandArgument="<%# ((GridViewRow)Container).RowIndex %>" runat="server" OnClientClick="return confirmDeleteRow()" />
                            </ItemTemplate>
                            <HeaderStyle Width="125px" />
                        </asp:TemplateField>

      <asp:CommandField SelectText="عرض"  HeaderText="عرض" ShowHeader="True" ShowSelectButton="True">  
                    <HeaderStyle HorizontalAlign="Right" />
                    </asp:CommandField>

                        <asp:TemplateField  HeaderText="تحميل">

                            <ItemTemplate>
                                <asp:LinkButton ID="DownLoad" CommandName="DownLoad"   Text="تحميل" ToolTip="تحميل" CommandArgument="<%# ((GridViewRow)Container).RowIndex %>" runat="server" />
                            </ItemTemplate>
                            <HeaderStyle Width="125px" />
                        </asp:TemplateField>


</Columns>
  <RowStyle Height="25px" />
                    <HeaderStyle Height="30px" />
                    <PagerStyle CssClass="pages" Wrap="false" />
</asp:gridview>

</div>
</div>


 </contenttemplate>
 <Triggers>

在按钮搜索中我绑定我的网格

就像在这段代码中

    protected void ShowDoc(string sCondition)
    {
    //declare connection by pass connection string from web.config
    SqlConnection sqlcon = new SqlConnection
        (ConfigurationManager.ConnectionStrings["SystemConn"].ConnectionString);

    //declare sql statment  as astring variable

    if (Session["Image"] != null)
    {
        Session.Remove("Image");
    }
    try
    {
        SqlStatment = string.Format("select distinct IssuesNum,DocType,DocTypeSub,DocCode,DocTypeName,Name,IssuesID,TypeID,TypeName,Area,IssuesNumSplited,Year   from [View_ImagesSearch] Where {0}  Order By [IssuesNumSplited] ASC", sCondition);

        //create asql command and pass for it the connection string and sql statment
        SqlCommand sqlcom = new SqlCommand(SqlStatment, sqlcon);

        //create data adaptor to bring data from database
        SqlDataAdapter sad = new SqlDataAdapter(sqlcom);

        // declare dataset to store data from data base in it
        DataSet ds = new DataSet();

        //fill data set with data adabter that contain data from database
        sad.Fill(ds);
        lblDocCount2.Text = ds.Tables[0].Rows.Count.ToString();
        Session["Image"] = ds;
        GvImages.DataSource = ds;
        GvImages.DataBind();

    }
    catch (Exception ex)
    {
        par_ErrorMessage.Visible = true;
        par_ErrorMessage.InnerText = ex.Message;
    }
   }

当我单击名为 عرض updatepanel 的命令时,可以显示另一个网格视图,但是当我单击项目模板下载时无法正常工作,直到我设置 EnablePartialRendering="False"

4

1 回答 1

0

确保在调用DataBind后调用UpdateUpdatePanelGridView

GridView.DataBind();
UpdatePanel.Update();

有关其他可能的解决方案,请参阅此内容。

于 2013-02-21T16:19:39.187 回答