Progress bar Issue : End results not displaying - c#

Im having an issue with my progress bar. Now I have looked through all of the questions in overflow and Ive been through alot of google searching. I may have overlooked something, but Ill bet you anything this problem is something really simply I keep overlooking. Heres the deal.
My progress bar seems to work just fine. Im using ajax, everything is in the right panel, it fires immediatly when the button is pushed and actually it stops once the process is completed (although I have no idea how I did that). Please note, this is as simple as it gets. Its just a GIF, nothing special. Using Visual Studio 2010, SQL Server 2008, Ajax, and C#. Im not using a jquery or js, although I may have too.
My application is simple. It sends orders to a different server, so I am on the client side. Once the button is clicked, the orders are in the process of being sent. My Problem is, although the orders are being sent, when the progress bar stops, and the process is done, my labels (success or error) and order database tables do not fire. Why is this? I find this very odd because the application sends the orders, it functions 100%, but nothing changes on the user side.
Here is some code, if you need more then just say the word. Thank you all in advance!
protected void Page_Load(object sender, EventArgs e)
{
Initialize();
}
protected void Page_PreRender(object sender, EventArgs e)
{
}
protected void Button_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Button btn = (Button)sender;
KaplanFTP.BatchFiles bf = new KaplanFTP.BatchFiles();
KaplanFTP.Transmit transmit = new KaplanFTP.Transmit();
if (btn.ID == PutFTPButton.ID)
{//code
private void Initialize()
{//code if success/notsuccess labels will fire
Also here is the design code if it helps
<body>
<form id="form1" runat="server">
<div class="mainPanel">
<div>
<h3>Number of Batches Created Today: <asp:Label runat="server" style="display:inline;" ID="BatchesCreatedLbl"></asp:Label></h3>
</div>
<div id="batchestoprocessdiv">
<asp:Label runat="server" ID="BatchesToProcessLbl" Text="THERE IS AN ORDER BATCH TO PROCESS." CssClass="green"></asp:Label>
</div>
<asp:Label runat="server" ID="NoBatchesToProcessLbl" Text="There are no Order Batches to Process." CssClass="red"
Visible="false"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="PutFTPButton" runat="server" onclick="Button_Click"
Text="Submit Orders" />
</ContentTemplate>
</asp:UpdatePanel>
<span class="red">COUNTDOWN TO SUBMISSION!</span>
<span id="timespan" class="red">
</span>
<asp:Label runat="server" ID="ErrorLabel" Visible="false" CssClass="red" Text="Error: "></asp:Label>
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img alt="" class="style1" src="images/ajax-loader.gif" />
<br />
<asp:Label ID="Label1" runat="server" CssClass="red" Height="16px"
Text="Sending Orders....Please Wait"></asp:Label>
</ProgressTemplate>
</asp:UpdateProgress>
<br />
<br />
<br />
<asp:Label runat="server" ID="SuccessLabel" Visible="false" CssClass="green" Text="Batch has been processed and uploaded successfully."></asp:Label>
</div>
<div id="OrdersInfoDiv" runat="server" visible="false">
<asp:GridView ID="BatchDetails" Caption="Details of orders ready to be sent" runat="server" AutoGenerateColumns="true"
CssClass="InfoTable" AlternatingRowStyle-CssClass="InfoTableAlternateRow" >
</asp:GridView>
</div>
<div id="OrdersSentDiv" class="mainPanel" runat="server" visible="false">
<h4>Sent Orders</h4>
</div>
</form>
<script src="js/SendOrders.js" type="text/javascript"></script>
</body>

Put all content those you want to refresh after download finished into UpdatePanel with UpdateMode="Always"

Related

UpdateProgress control should show progressing until code executes

UpdateProgress control should show progressing until code executes.
I have set of code inside button_click(), progress bar should progress until code executes.
I can use Thread.sleep(5000), but my code takes more time and it varies from one request to another request. How can I resolve this? Please help me out.
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class="modal">
<div class="center">
<img alt="" src="loader.gif" />
</div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div align="center">
    <h1>Click the button to see the UpdateProgress!</h1>
    <asp:Button ID="Button1" runat="server"
Text="Submit" OnClick="Button1_Click" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
Button handler code:
protected void Button1_Click(object sender, EventArgs e)
{
    System.Threading.Thread.Sleep(5000);
}

Set value in Parent Page from Modal Popup Extender

I am testing the ModalPopupExtender in a simple web application. The user should input a value in the modalpopup and then this value would be shown in the parent page after closing the modal popup.
I used this code for the design:
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Button runat="server" ID="BtnOpenPopup" Text="Open Popup" />
<asp:Label runat="server" ID="lbl" ></asp:Label>
<asp:Panel runat="server" ID="PnlTest">
<asp:TextBox runat="server" ID="txtInput"></asp:TextBox>
<asp:Button runat="server" ID="BtnSubmit" Text="Submit" OnClick="BtnSubmit_Click" />
</asp:Panel>
<ajaxToolkit:ModalPopupExtender runat="server" TargetControlID="BtnOpenPopup" EnableViewState="true" OkControlID="BtnSubmit" PopupControlID="PnlTest" ></ajaxToolkit:ModalPopupExtender>
</div>
</form>
</body>
</html>
And this is my code behind:
protected void BtnSubmit_Click(object sender, EventArgs e)
{
lbl.Text = txtInput.Text;
}
This didn't work, I don't get any errors, but still the lbl isn't loaded with the user input.
Would appreciate if you can give me some insight on how this works.
Hello I guess that you have to add a script for the OnOkScript attribute, try this :
//......
//.......
<ajaxToolkit:ModalPopupExtender runat="server"
TargetControlID="BtnOpenPopup"
EnableViewState="true"
OkControlID="BtnSubmit"
PopupControlID="PnlTest"
OnOkScript="onModalOk();"> <!-- here is the tag you have to add to get it work -->
</ajaxToolkit:ModalPopupExtender>
</div>
</form>
<script>
function onModalOk()
{
document.getElementById("lbl").innerText = document.getElementById('txtInput').value;
}
</script>

asp.net wizard control, set step name unvisible

I don't want to show stepname. "Next" and "finish button" is enough for me. How to unvisible these?!
Second question's; after FinishButton's click, I want to redirect first step automatically. How to do?
<asp:Wizard runat="server" ID="MyWizard" OnNextButtonClick="MyWizard_NextButtonClick"
Width="440px" Height="200px" OnFinishButtonClick="MyWizard_FinishButtonClick">
<WizardSteps>
<asp:WizardStep ID="Wizardstep1" runat="server" StepType="auto">
</asp:WizardStep>
<asp:WizardStep ID="Wizardstep2" runat="server" StepType="auto">
</asp:WizardStep>
You can create your custom LayoutTemplate within Wizard control to hide step names. For example:
<LayoutTemplate>
<div>
<asp:PlaceHolder ID="headerPlaceHolder" runat="server" />
</div>
<div>
<asp:PlaceHolder ID="wizardStepPlaceholder" runat="server" />
</div>
<div>
<asp:PlaceHolder ID="navigationPlaceholder" runat="server" />
</div>
</LayoutTemplate>
Remeber that placeholders' id names matter. Placeholer responsible for displaying list of steps that you circled has id sideBarPlaceHolder (and you should not have any placeholder with this id inside LayoutTemlpate)
Second question:
You can have custom navigation template, for example:
<FinishNavigationTemplate>
<asp:Button ID="PreviousButton" runat="server" Text="Previous step" CausesValidation="false" CommandName="MovePrevious" />
<asp:Button ID="FinishButton" runat="server" Text="Finish" CausesValidation="true" CommandName="MoveComplete" OnCLick="FinishButton_Click" />
</FinishNavigationTemplate>
Note that these buttons have fixed CommandName (Wizard control expects this). You can try to use finish button's OnClick event to jump to the first step:
protected void FinishButton_Click(object sender, EventArgs e)
{
yourWizard.ActiveStepIndex = 0;
}

asp.net progress loading

I have a page that is taking a couple of seconds to load due to a lot of data being displayed.
How can i make it so that it plays a .gif animation until the data is ready to be displayed in a table instead of not having anything displayed?
How to set the table/content to display only after the loading is complete?
you can use asp.net ajax control, for example ScriptManager + UpdateProgress + UpdatePanel.
Here an example
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdateProgress runat="server" id="PageUpdateProgress">
<ProgressTemplate>
Loading...
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" id="Panel">
<ContentTemplate>
<asp:Button runat="server" id="UpdateButton" onclick="UpdateButton_Click" text="Update" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
protected void UpdateButton_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}

How do we display a progress bar in C# for a button click event in WebForm?

I have a button click event which does a lengthy function and takes time. So i want to display a progress bar. Can you let me know how can I do it.
I am very new to .NEt .. any help appreciated
Thanks in Advance,
Amritha
I think this example is basic enough:
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server" />
<asp:UpdateProgress runat="server" id="PageUpdateProgress">
<ProgressTemplate>
Loading...
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" id="Panel">
<ContentTemplate>
<asp:Button runat="server" id="upd" onclick="updButton_Click"
text="click to update" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
In code behind updButton_Click takes a long time to update, during the period you will see Loading... on the page, you can change the text to a <img src="blabla" /> to make it more like a ProgressBar(such as a GIF moving-bar image)

Categories

Resources