Show UpdateProgress in update panel only when a particular event is occur - asp.net

I have an update panel which contains two buttons one is submit and other is cancel.
Now i want when i will click on submit button then progress bar displays.
But when i will click on cancel button it should not display.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<br />
<asp:UpdateProgress runat="server" ID="PageUpdateProgress" DisplayAfter="0" >
<ProgressTemplate>
<img src="../images/ajax-loader.gif" alt="Loading...." /><br />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:LinkButton ID="lnkSubmit" runat="server" CssClass="lnk">Submit</asp:LinkButton>
<asp:LinkButton ID="lnkCancel" runat="server" CssClass="lnk">Cancel</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
Please help me i am tired to try to solve it.
Thanks ,Rajbir

Related

Update Progress Bar While Inserting Data Into Database

foreach (DataRow row in Employee.Rows)
{
//insert record into database. when record entered i need to update the progress
//bar on client side.
}
How to solve my Problem?
Take your Insert Button in Update Panel and assign Update Progress to your Update Panel as shown below.
<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel" runat="server">
<ProgressTemplate>
<div>
<asp:Image ID="Image" runat="server" ImageAlign="Middle" ImageUrl="Images/loading.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>

Submit button doesn't work on enter in IE aspp.net

<asp:Button ID="newbutton" runat="server" Text="Click" onsubmit="button_click" OnClick="button_click" />
I have this button in update panel and i want it to work on enter not only onclick it works in google chrome , but not in ie what should I do?
On the panel set the default button to the id of the button
<asp:Panel runat="server" id="examplePanel" DefaultButton="newbutton">
Set the default button for update panel with the Id of this button
Sample:
<asp:UpdatePanel ID="upTest" runat="server">
<ContentTemplate>
<asp:Panel runat="server" ID="pTest" DefaultButton="newbutton">
<asp:Button ID="newbutton" runat="server" Text="Click" onsubmit="button_click" OnClick="button_click" />
ASP:Button cannot work with enter because it has OnClick. To react on enter properly you should use ASP:Panel with DefaultButton property. You need to have focus on control inside asp:Panel for example TextBox
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Panel ID="Panel1" runat="server" DefaultButton="newbutton">
<asp:TextBox ID="TxtUserLogin" runat="server" TabIndex="1" Text="login" />
<asp:Button ID="newbutton" runat="server" Text="Click" OnClick="button_click" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>

ProgressBar show in GridView in asp.net

In Gridview cell, I have to show ProgressBar in ASP.NET.
I am using async event in ASP.NET 4.0
Could you guide me to find the solution for it?
I assume you mean from the client side ajax. If not, can you elaborate? If you are using a simple update panel you can just drop a Update Progress control on the page and put whatever you want to display as "progress" in the ProgressTemplate.
<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>

Creating Multiple Hidden Div's in ASP.Net |Ajax | JQuery

i'm kinda new in web programming,
i'm trying to design a search page.
i want to creating few radio buttons where each click on a radio button will show a div
contains the related search div's.
and from there to do the query to the database(not related to the post)
how can i do that ?
tried to search for it , and didn't get good answer.
i want that the change of the page will be in server side and not the client side.
p.s.
i have been working with ajax control kit so far..
thanks for the help.
You just need an UpdatePanel, radio buttons and a MultiView control.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div>
<asp:RadioButton ...
<asp:RadioButton ...
</div>
<asp:MultiView ID="mvAll" runat="server" ActiveViewIndex="-1">
<asp:View ID="vwFirst" runat="server">
</asp:View>
<asp:View ID="vwSecond" runat="server">
</asp:View>
...
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>
When the selected radio button changed you just set the View related to be active,
mvAll.SetActiveView(ViewIDYouNeed);
You can accomplish this with Panels and an Update Panel.
<asp:RadioButton ID="rdo1" AutoPostBack="true" GroupName="radios" runat="server" OnCheckedChanged="ShowDivs" />
<asp:RadioButton ID="rdo2" AutoPostBack="true" GroupName="radio2" runat="server" OnCheckedChanged="ShowDivs" />
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Panel ID="pnl1" runat="server" Visible="false"></asp:Panel>
<asp:Panel ID="pnl2" runat="server" Visible="false"></asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rdo1" />
<asp:AsyncPostBackTrigger ControlID="rdo2" />
</Triggers>
</asp:UpdatePanel>
You would then handle setting the Visible property of the panels in your ShowDivs method in your code behind.
Or, you could use jquery/javascript to accomplish this.
<input type="radio" onClick="ShowDiv(1)" />
function ShowDiv(id) {
HideDivs();
$(id).show('slow');
}

Update panel can not find the button which trigger it

I have a button is inside a another table(s) inside the update panel.
<Update panel>
<ContentTemplate>
<table>
<table>
<Button>
<table>
<table>
</ContentTemplate>
</Update panel>
I would like to add a button to Update panel's trigger.
But am getting an err says "Update panel can not find the button which trigger it".
I am getting "Sys.Webforms.PageRequestmanagerParseErrorException: This message recieved from manager could not be parsed. Common cause for this error are when response is modified by response.write"
Please help!
PostBackTrigger example:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btn1" runat="server" Text="Button 1-Partial Postback" />
<asp:Button ID="btn2" runat="server" Text="Button 2-Full Postback" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btn2" />
</Triggers>
</asp:UpdatePanel>

Resources