In IE11,IE10 Page postbacks occur when button is clicked - c#

In my code on running from local Postback did not occur on button trigger click,but when i run through production url and click button complete Postback occurs.How to handle page postback in IE11,IE10.In all the other browsers it works fine with no postback of page.I googled ut did not get the solution for IE.

keep your all controls into update panel
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>

Related

Panel not displayed in UpdatePanel

<form runat="server" id="from1">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<script src='https://www.google.com/recaptcha/api.js'></script>
<asp:Panel runat="server" ID="pnlSiteQuestions">
>>>>> CONTROLS removed for brevity <<<<<
<asp:Button ID="btnContinue" runat="server" Text="Continue" OnClick="btnContinue_Click" ValidationGroup="Questions" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="pnlNotRequired" runat="server" Visible="false">
Sorry you do not qualify.
</asp:Panel>
<asp:Panel runat="server" ID="pnlAdditionalDetails" Visible="false">
<asp:ValidationSummary runat="server" ID="ValidationSummary1" />
Name
<asp:RequiredFieldValidator runat="server" ID="ValidatorName" ControlToValidate="ContactFormNameTextBox" ErrorMessage="Name is required" CssClass="ErrorClass">Required</asp:RequiredFieldValidator>
<asp:TextBox runat="server" ID="txtName" />
<div class="g-recaptcha" data-sitekey="ABC123"></div>
<asp:Button runat="server" ID="button1" Text="Confirm" OnClick="button1_Click" />
</asp:Panel>
</form>
I have the above form and decided to add an update panel. When a user clicks Continue, it goes to a database and determines if the user qualifies. If not pnlNotRequired message is displayed otherwise pnlAdditionalDetails is displayed.
Everything is/was working until i added the update panel. So removing the UP has everything working.
I tried adding a trigger but i didnt fully understand how it should be configured as i dont completely understand why this is occurring?
No Javascript errors listed either. Anyway to overcome this issue?
Update panel should cover all panels. Add property to update panel "UpdateMode='Conditional'" than add trigger block

Progress of a process in a website with c#

I created a website with c# and I have a process that lasts between 1 and 4 seconds (uploading data from database).
I want that I show a bar or image_process for waiting(from when I click on the button that import data from the database until displaying that data on my Gridview)
I found this code but this code contains another button..I don't need another button..I want that my previous one import data and display the waiting image.
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1"
AssociatedUpdatePanelID="UpdatePanel1" runat="server">
<ProgressTemplate><img src="animatedprogress.jpg"/></ProgressTemplate>
</asp:UpdateProgress>

AJAX In ItemTemplate Doesn't Work

In this aspx code example the Timer inside UpdatePanel in ListView doesn't make async refresh. In this code it refreshes the whole page like AJAX doesn't exists here. What should I do to remove this problem ?
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Label ID="Label1" runat="server" Text="SIMPLE FIELD"></asp:Label>
<br />
<asp:ListView ID="DataListView" runat="server">
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="500"></asp:Timer>
<asp:Label ID="Label2" runat="server" Text="AJAX"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:ListView>
</div>
</form>
You should wrap the entire ListView in the UpdatePanel.
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ListView ID="DataListView" runat="server">
<ItemTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="500"></asp:Timer>
<asp:Label ID="Label2" runat="server" Text="AJAX"></asp:Label>
</ItemTemplate>
</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>
I think there might be an issue where because the ListView doesn't do any rendering of its own, the UpdatePanel can't figure out the "parent" item to update. I think it's an unfortunate consequence of the design of the UpdatePanel.
I would recommend trying to put the UpdatePanel inside its own container control, such as an and see if that produces the correct result.

Create Loading animation before navigating to another page and disable all conrols on it during animation

I have a button on Page 1 and when the button click event occurs, I had to do some process that takes around 2-3 seconds. So, I want to Put a Loading Image in Center and disable all other controls on the Page 1.
I tried using UpdatePanel :
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button runat="server" Text="Button" onclick="Unnamed1_Click" />
<asp:Label runat="server" Text="Label" ID="lbl"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" >
<ProgressTemplate>
<div id="IMGDIV1" align="center" valign="middle" runat="server" style="position: absolute;visibility:visible;vertical-align:middle;border-style:none;border-color:black;background-color:transparent;">
<asp:Image ID="Image1" runat="server" ImageUrl="~/ajax-loader (1).gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
But the controls did not get disabled. Any Solution or Javascript ??
Also I want that it should work if want to stay on the same page.
why dont yu use telerik radgrid loading panel ?
http://www.telerik.com/help/aspnet-ajax/ajax-center-loadingpanel.html

Pop-up with radiobuttons

I have a registration page where i have a register button and when it is clicked i have to get a pop up with radio buttons like parent and child.How to do this without javascript?I am using c# and asp.net.
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
Visible="False">
<asp:ListItem>parent</asp:ListItem>
<asp:ListItem>child</asp:ListItem>
</asp:RadioButtonList>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<cc1:ModalPopupExtender ID="RadioButtonList1_ModalPopupExtender" runat="server" PopupControlID="form1"
DynamicServicePath="" Enabled="True" TargetControlID="Button1">
</cc1:ModalPopupExtender>
</div>
</form>
</body>
Easiest way to do this is using JQuery. I suggest you to give it a try.
You could just submit what the user has done so far, and direct to a different page with those radio buttons.
Or make a link to pop-up a new window to the radio buttons perhaps.
Or use css hoveron effect to mimic a popup block, thought this doesn't work like buttons.

Categories

Resources