Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using an UpdatePanel

Status
Not open for further replies.

JScannell

Programmer
Jan 9, 2001
306
0
0
US
I am fairly new to asp.net for web development. I'm trying to do something that on the surface seems simple but when it is implemented it is anything but. I have a few textbox controls that need to be updated immediately from within a click event on a web page. All the examples I've found online are extremely simple and seem to work if I implement them. However, my real code doesn't work. Here is the code in its entirety. I've highlighted the UpdatePanel things as well as the controls that need to get updated in my click event:

<div>
<asp:UpdatePanel ID="DetailExport_UpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td>
<table width="900">
<tr>
<td valign="Middle" colspan="3">
<asp:Label ID="Label19" runat="server" Font-Bold="True" Font-Size="Large" Text="Search Results" />
<asp:Button ID="btnExport" runat="server" CssClass="btnWrap" Text="Export Detail to Excel" />
<asp:Label ID="clblDetailData_Message" runat="server" Font-Bold="True" Text="Total Records 99,999 " />
<asp:Label ID="clblExportInfo" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td colspan="3"><hr size="3" color="Blue" /></td>
</tr>
<tr>
<td>
<asp:panel ID="pnlPages" runat="server" Height="25px" Width="500px">
<asp:Label ID="lblPage_of_Pages" runat="server" Text="Page xx of yy" Font-Bold="True" />
<asp:Button ID="btnFirst" runat="server" Text="First" />
<asp:Button ID="btnPrev" runat="server" Text="&lt; Prev" />
<asp:Label ID="lblRows_of_Rows" runat="server" Text="Rows xxxx - yyyy" Font-Bold="True" />
<asp:Button ID="btnNext" runat="server" Text="Next &gt;" />
<asp:Button ID="btnLast" runat="server" Text="Last" />
</asp:panel>
</td>
</tr>
</table>
</td>
<td>
<table width = "400">
<tr><td align="right"><asp:Label ID="Label9" runat="server" Text="Export Est. Time" Font-Bold="True" /></td><td><asp:TextBox ID="txtEstimatedTime" runat="server" BorderStyle="None" /></td></tr>
<tr><td align="right"><asp:Label ID="Label18" runat="server" Text="Export Started" Font-Bold="True" /></td><td><asp:TextBox ID="txtStarted" runat="server" BorderStyle="None" /></td></tr>
<tr><td align="right"><asp:Label ID="Label20" runat="server" Text="Export Stopped" Font-Bold="True" /></td><td><asp:TextBox ID="txtStopped" runat="server" BorderStyle="None" /></td></tr>
<tr><td align="right"><asp:Label ID="Label26" runat="server" Text="Elapsed Time" Font-Bold="True" /></td><td><asp:TextBox ID="txtElapsed" runat="server" BorderStyle="None" /></td></tr>
</table>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnExport" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>


Here is my click event that is attempting to update some of the text and label controls within the UpdatePanel:

Protected Sub btnExport_Click(sender As Object, e As EventArgs) Handles btnExport.Click
Dim strFilename As String = "AMS_SalesAnalysis.xlsx"
Dim strFullFileName As String = ""
Dim flgTesting As Boolean = True
Dim oExcelApp As Excel.Application = New Microsoft.Office.Interop.Excel.Application

txtEstimatedTime.Visible = True
txtStarted.Visible = True
txtStopped.Visible = True
txtElapsed.Visible = True

txtStarted.Text = ""
txtStopped.Text = ""
txtElapsed.Text = ""

clblExportInfo.Text = " Please Wait --- Creating Excel File "
clblExportInfo.Visible = True

txtStarted.Text = datetime.now.tostring( "HH:mm:ss" )
'
' Process ensues that takes several seconds
'
txtStopped.Text = datetime.now.tostring( "HH:mm:ss" )
End Sub

The clblExportInfo, txtStarted contents should be made visible immediately after being set, then after the process the txtStopped is updated. What is actually happening is that the contents of all the controls appear when the process is finished.

I hope this is a simple solution.

Thanks in advance,
Jerry

Jerry Scannell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top