4
Answers

GridView inside a update panel

Lasantha PW

Lasantha PW

13y
18.5k
1

hi all.
my issue is, i have a gridview inside a update panel.i'm trying to edit update the records.problem is grid is not update.always give previous values.
here my code
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>


<asp:AsyncPostBackTrigger ControlID="searchbtn" />
<asp:AsyncPostBackTrigger ControlID="cpmpletebtn" />
</Triggers>
<ContentTemplate>


<asp:GridView ID="transactiongrid" runat="server" AutoGenerateColumns="False"
onrowdatabound="transactiongrid_RowDataBound"
onrowediting="transactiongrid_RowEditing"
onrowupdating="transactiongrid_RowUpdating" AllowPaging="True"
onpageindexchanging="transactiongrid_PageIndexChanging" PageSize="15" AlternatingRowStyle-BackColor="#e8f5f9"
>
<Columns>

<asp:TemplateField>

<ItemTemplate>
<asp:Button ID="editbtn" runat="server" Text="Edit" CommandName="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:Button ID="updatebtn" runat="server"
Text="Update" CommandName="Update" />
</EditItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="Confirmation Status">
<ItemTemplate>
<asp:Label ID="Autharisationlbl2" runat="server" Text='<%#Eval("authostatus") %>' Visible="false"></asp:Label>
<asp:Label ID="confirmationstatelbl" runat="server" Text='<%#Eval("confermationstatus") %>' Visible="false"></asp:Label>
<asp:Image ID="confirmationimg" runat="server" Width="20" Height="20" />
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="confirmationstatelbl_edit" runat="server" Text='<%#Bind("confermationstatus") %>' Visible="false"></asp:Label>
<asp:Label ID="Autharisationlbl" runat="server" Text='<%#Eval("authostatus") %>' Visible="false"></asp:Label>
<asp:DropDownList ID="confirmationstateddl" runat="server">
<asp:ListItem Text="Pending" Value="1"></asp:ListItem>
<asp:ListItem Text="Complete" Value="2"></asp:ListItem>
<asp:ListItem Text="Cancel" Value="3"></asp:ListItem>
</asp:DropDownList>

</EditItemTemplate>
</asp:TemplateField>
it always gives previous value for confirmation status.as a example i set confimation pending to complete and next row edit but prev row says its confirmation value is pending 
Answers (4)