Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 10, 2012 10:49 AM by pierrefrc
Member
2 Points
5 Posts
May 08, 2012 09:27 AM|LINK
while at button click i dnt get the message "Labeled Sucessfully" in label, instead after executing the Async webmethod only the label get render. even the grid bind is not working at tht time. please find the sample code
Aspx:
<asp:UpdatePanel ID="upGrid" runat="server" UpdateMode="Conditional" > <ContentTemplate> <table style="width:750px"> <tr align="center"> <td align="center" class="style18"> <table border="0" style="border-color: #3E6C13; background-color: #669900; width: 590px; height: 20px; margin-bottom: 0px;"> <tr align="center"> <td class="srchBtnOption" align="center"> <asp:Button ID="btnProcess" runat="server" Height="25px" class="btn" onclick="btnProcess_Click" Text="Process" Width="150px" /> <br /> <br /> </td> </tr> </table> </td> </tr> <tr align="center" > <td align="center"> <asp:Label ID="lblMsg" runat="server" ForeColor="Maroon" Height="18px" EnableViewState="False"></asp:Label> <%strMsg.ToString(); %> <asp:HiddenField ID="hdnMsg" runat="server" /> </td> </tr> <tr align="center"> <td align="center"> <asp:Timer ID="tmrWrprDet" runat="server" Interval="3600" ontick="tmrWrprDet_Tick"></asp:Timer> <asp:GridView ID="uxGridViewCJ" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BorderColor="#669900" BorderStyle="Ridge" BorderWidth="2px" CellPadding="1" CellSpacing="1" EmptyDataText="No Records Found!.." onpageindexchanging="uxGridViewCJ_PageIndexChanging" onsorting="uxGridViewCJ_Sorting" PageSize="10"> <RowStyle backcolor="White" font-italic="true" ForeColor="Black" /> <Columns> <asp:BoundField DataField="START_DATE" HeaderText="Start_Date" ItemStyle-HorizontalAlign="Center" SortExpression="START_DATE"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="END_DATE" HeaderText="End_Date" ItemStyle-HorizontalAlign="Center" SortExpression="END_DATE"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> </Columns> <HeaderStyle BackColor="#333300" ForeColor="White" /> </asp:GridView> </td> </tr> </table> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="btnProcess" /> </Triggers> </asp:UpdatePanel>
Page.cs:
sample code:
protected void btnProcess_Click(object sender, EventArgs e) { //Asyncwebmethod calling obj.webmethodAsync(); lblMsg.Text = "Labeled Sucessfully";
//Grid binding da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new DataSet(); da.Fill(ds); uxGridViewCJ.DataSource = ds.Tables[0]; uxGridViewCJ.DataBind(); uxGridViewCJ.Visible = true; }
All-Star
113532 Points
12480 Posts
Microsoft
May 10, 2012 08:23 AM|LINK
Hi,
Try to add Asyncpostbacktrigger to the button click event.
Thanks,
Participant
947 Points
201 Posts
May 10, 2012 10:49 AM|LINK
Hi
Try too change the attribute UpdateMode="Always".
http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.updatemode.aspx
munishpratha...
Member
2 Points
5 Posts
Label Inside Updatepanel is not Working
May 08, 2012 09:27 AM|LINK
while at button click i dnt get the message "Labeled Sucessfully" in label, instead after executing the Async webmethod only the label get render. even the grid bind is not working at tht time. please find the sample code
Aspx:
<asp:UpdatePanel ID="upGrid" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<table style="width:750px">
<tr align="center">
<td align="center" class="style18">
<table border="0" style="border-color: #3E6C13; background-color: #669900; width: 590px; height: 20px; margin-bottom: 0px;">
<tr align="center">
<td class="srchBtnOption" align="center">
<asp:Button ID="btnProcess" runat="server" Height="25px" class="btn" onclick="btnProcess_Click" Text="Process" Width="150px" />
<br />
<br />
</td>
</tr>
</table>
</td>
</tr>
<tr align="center" >
<td align="center">
<asp:Label ID="lblMsg" runat="server" ForeColor="Maroon" Height="18px" EnableViewState="False"></asp:Label>
<%strMsg.ToString(); %>
<asp:HiddenField ID="hdnMsg" runat="server" />
</td>
</tr>
<tr align="center">
<td align="center">
<asp:Timer ID="tmrWrprDet" runat="server" Interval="3600" ontick="tmrWrprDet_Tick"></asp:Timer>
<asp:GridView ID="uxGridViewCJ" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BorderColor="#669900"
BorderStyle="Ridge" BorderWidth="2px" CellPadding="1" CellSpacing="1"
EmptyDataText="No Records Found!.."
onpageindexchanging="uxGridViewCJ_PageIndexChanging"
onsorting="uxGridViewCJ_Sorting" PageSize="10">
<RowStyle backcolor="White" font-italic="true" ForeColor="Black" />
<Columns>
<asp:BoundField DataField="START_DATE" HeaderText="Start_Date"
ItemStyle-HorizontalAlign="Center" SortExpression="START_DATE">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="END_DATE" HeaderText="End_Date"
ItemStyle-HorizontalAlign="Center" SortExpression="END_DATE">
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
</Columns>
<HeaderStyle BackColor="#333300" ForeColor="White" />
</asp:GridView>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnProcess" />
</Triggers>
</asp:UpdatePanel>
Page.cs:
sample code:
protected void btnProcess_Click(object sender, EventArgs e)
{
//Asyncwebmethod calling
obj.webmethodAsync();
lblMsg.Text = "Labeled Sucessfully";
//Grid binding
da = new OracleDataAdapter(cmd);
cb = new OracleCommandBuilder(da);
ds = new DataSet();
da.Fill(ds);
uxGridViewCJ.DataSource = ds.Tables[0];
uxGridViewCJ.DataBind();
uxGridViewCJ.Visible = true;
}
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: Label Inside Updatepanel is not Working
May 10, 2012 08:23 AM|LINK
Hi,
Try to add Asyncpostbacktrigger to the button click event.
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework
pierrefrc
Participant
947 Points
201 Posts
Re: Label Inside Updatepanel is not Working
May 10, 2012 10:49 AM|LINK
Hi
Try too change the attribute UpdateMode="Always".
http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.updatemode.aspx