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
Loading
Suthish NairPosted Jan 30, 2011, 1:17 PM
So other members can easily find the answers.
Suthish NairPosted Jan 27, 2011, 11:12 AM
Also, remember to use always UpdateMode="Conditional" for update panel.
Lasantha PWPosted Jan 27, 2011, 5:32 AM
that is not due to update panel.i resolved it.
thanks
Krishna GaradPosted Jan 26, 2011, 6:51 AM
if(!IsPostBack)
{
// Bind Grid
}
Because when we not bind grid it will be bind again with old values not getting updated in DB cause Page_load fire before any event to fire while postback.