Click here to Skip to main content
11,641,067 members (59,164 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
I have one Gridview.when click on Gridview image button, outside Gridview controls are fillup,which means other controls are inside one panel. problem is that, when click on Gridview controls are fill up inside panel. but page refresh.
Can anyone please help me to avoid flickering(Refresh) the page.
Code below describe.Thanks in advance.Please try to give me easy and understanding code as i am very new in the system.

<asp:GridView ID="displaygrid" runat="server" Width="100%" DataKeyNames="ncode" AllowCustomPaging="True" AllowPaging="True" AutoGenerateColumns="False"
AllowSorting="True" onrowediting="displaygrid_RowEditing">
<SelectedRowStyle ForeColor="Blue" CssClass="td" />
<AlternatingRowStyle Height="17px" CssClass="tdbox2" />
  <RowStyle Height="17px" CssClass="tdbox" />
     <HeaderStyle Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" CssClass="tdbox1" />
                                                 <asp:ButtonField Text="&lt;img alt=Edit border=0  src=./images/edit_icon.gif&gt;"  HeaderText="Edit" CommandName="Edit" >
                                                  <HeaderStyle Width="3%" />
                                                  <ItemStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="Black" VerticalAlign="Middle"></ItemStyle>
                                                  <asp:ButtonField Text="&lt;img alt=Delete border=0  src=./images/delete_icon.gif&gt;" HeaderText="Delete" CommandName="Delete">
                                                        <HeaderStyle Width="3%"></HeaderStyle>
                                                        <ItemStyle Font-Bold="True" Wrap="False" HorizontalAlign="Center" ForeColor="Black"></ItemStyle>
                                                    <asp:ButtonField Text="&lt;img alt=View border=0  src=./images/view_icon.gif&gt;" HeaderText="View" CommandName="Cancel">
                                                        <HeaderStyle Width="3%"></HeaderStyle>
                                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle"></ItemStyle>
                                                    <asp:TemplateField HeaderText="User Full Name">
                                                            <asp:Label ID="lblUserFullName" runat="server" Text='<%# Bind("UserFullName") %>'></asp:Label>
                                                    <asp:TemplateField HeaderText="Config Item">
                                                            <asp:Label ID="lblConfigItemVal" runat="server" Text='<%# Bind("ConfigItem") %>'></asp:Label>
                                                  <asp:TemplateField HeaderText="Component">
                                                          <asp:Label ID="lblComponentVal" runat="server" Text='<%# Bind("Component") %>'></asp:Label>
                                              <PagerStyle VerticalAlign="Middle" HorizontalAlign="Right" CssClass="td"></PagerStyle>

<asp:Panel id="PnlEntry" runat="server" Width="100%" >
          <table id="Table2" cellspacing="2" cellpadding="1" width="98%" align="center" border="0">
                                    <td class="tdbox1" align="left" colspan="5" height="25px"><strong>&nbsp; Daily Work Log</strong></td>
                                    <td class="tdbox" align="left" width="15%" >&nbsp; Config Item &nbsp; </td>
                                    <td class="tdbox2" align="left"  width="25%" >
                                        <asp:DropDownList ID="ddlConfigItem" runat="server" Width="70%" CssClass="textarea1" height="23px"></asp:DropDownList>
                                <td class="tdbox2" align="left"  width="20%" ></td>
                                    <td class="tdbox" align="left" width="15%" >&nbsp; Component &nbsp; </td>
                                    <td class="tdbox2" align="left" width="25%" >
                                       <asp:DropDownList ID="ddlComponent" runat="server" Width="71%" CssClass="textarea1" height="25px"></asp:DropDownList>

.CS page
protected void displaygrid_RowEditing(object sender, GridViewEditEventArgs e)
            int index = Convert.ToInt32(displaygrid.DataKeys[e.NewEditIndex].Value.ToString());
public void EditGrid(int id)
            string stredit = "SELECT * FROM dbo.vw_DWL WHERE ncode=" + id;
            CommanClass cl = new CommanClass();
            DataSet dsTobind = cl.Getdataset(stredit);
            if (dsTobind.Tables[0].Rows.Count >
Posted 6-Sep-12 23:44pm
Edited 6-Sep-12 23:49pm
cpsglauco at 7-Sep-12 6:00am
what do you mean by "page refresh"? the page is reloaded? it's normal
Karthik_J, Coimbatore at 7-Sep-12 8:18am
Use Update panel

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mika Wendelius 400
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 145
4 Afzaal Ahmad Zeeshan 129
0 Mika Wendelius 380
1 OriginalGriff 205
2 DamithSL 203
3 CPallini 125
4 Afzaal Ahmad Zeeshan 89

Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 7 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100