0
votes

i have a grid view inside update panel with multiple bound fields the last two bound field as shown in image when click show another grid view without post back but download not working except i set EnablePartialRendering="false" of script-manager but in this case updatepanel not working to show bound field

enter image description here

    <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>

in button search i bind my grid

like in this code

    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;
    }
   }

when i click command called عرض updatepanel work to show another gridview but when iclick item template download not workink fine untill i set EnablePartialRendering="False"

1

1 Answers

0
votes

Make sure you are calling Update on the UpdatePanel after you call DataBind on the GridView:

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

See this for other possible solutions.