I have two UpdatePanel in a single asp.net page.One has a submit button and a progress bar , on click on this button there is a process which fetch the data from a XML file and stores in Database.
Second update panel is used to display the content from a log about the progress of the data insertion from XML and it is updated using a timer control.
Now the problem is that when a request is submitted from first panel , second panel stop updating the content.
Should I try any other library or some sort of jq metohods to update page.
thanx in advance
here is my code,...
<asp:scriptmanager runat="server" ID="scrpManager"> </asp:scriptmanager>
<asp:UpdatePanel ID="updLeft" runat ="server">
<ContentTemplate>
<asp:Button ID="Submit" runat="server" onclick="Submit_Click"
Text="Process" />
</ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="Button3" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="updLeft"
ID="UpdateProgress21">
<ProgressTemplate>
<div class="loadingbox">
<img src="spinner.gif" align="absmiddle" />
<asp:Label ID="lblProgress21" runat="server">Please wait while processing...</asp:Label>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="updPnlRight" runat ="server" >
<ContentTemplate >
<asp:Timer Interval="1000" ID="timer1" runat="server" ontick="timer1_Tick" ></asp:Timer>
<asp:GridView ID="GridView1" ShowHeader ="false" AutoGenerateColumns ="false" runat="server">
<Columns >
<asp:BoundField DataField ="status_MSG" HeaderText ="" />
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers >
<ajax:AsyncPostBackTrigger ControlID ="timer1" EventName="Tick" />
</Triggers>
</ajax:UpdatePanel>
protected void Submit_Click(object sender, EventArgs e)
{
//Do insertion process , takes 30 minutes,
}
I've had nothing but misery with update panels. I urge you to use an alternative such as client side templates. Knockout.js and Angular.js are probably good places to start.
If you paste your code, or a (non) working example of your issue, I'll try offer a fix.
Related
If i am using update panel then PostedFile not giving file path some error are coming and if update panel are removed the page then excel file successfully upload how to solve
your code should be as shown below
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload runat="server" ID="flFile" />
<asp:Button runat="server" ID="btnSubmit" Text="Upload" OnClick="btnSubmit_Click" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>
You need to put postback trigger if you are uploading any files.
A FileUpload inside UpdatePanel won't work. You have to post the whole page. You do this by adding a PostBackTrigger to the button you use for uploading files.
Something like this (see Triggers):
<asp:UpdatePanel ID="upnlMain" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:FileUpload ID="fileUpload" runat="server" Width="400px" />
<asp:Button ID="btnUploadFiles" runat="server" Text="Upload files" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnUploadFiles" />
</Triggers>
</asp:UpdatePanel>
If you have problems with not posting the first time a button is clicked then add this to Page Load event:
Page.Form.Attributes.Add("enctype", "multipart/form-data");
I have an 2 Update Panel Namely (IDs) as upDMList for UpdatePanel 1 and UpdatePanel2 for second UpdatePanel. I have a Gridview inside UpdatePanel1 which has LinkButton. This Link button need to act as Trigger for second Update Panel but it always shows error
I have tried various methods
For Example - When I target Control using Gridview ID it shows this error
Exception Details: System.InvalidOperationException: A control with ID 'gvDMList$lnkAccountImage' could not be found for the trigger in UpdatePanel 'UpdatePanel2'.
When I Target Control Using only Link Button ID it shows Error
A control with ID 'lnkAccountImage' could not be found for the trigger in UpdatePanel 'UpdatePanel2'.
Even while targetting using Update Panel 1 ID the error is
A control with ID 'upDMList$gvDMList$lnkAccountImage' could not be found for the trigger in UpdatePanel 'UpdatePanel2'.
Both UpdatePanel has ChildrenAsTriggers set to true and ClientIDMode=Static
Any help would be useful
Here is relevant code
`<asp:UpdatePanel ID="upDMList" runat="server" ClientIDMode="Static" ChildrenAsTriggers="true" >
<ContentTemplate>
<div class="table-responsive">
<asp:GridView ID="gvDMList" ClientIDMode="Static" AutoGenerateColumns="false" style="margin: 0 auto" DataKeyNames="DMID" OnRowCreated="gvDMList_RowCreated" OnRowDataBound="gvDMList_RowDataBound" OnRowCancelingEdit="gvDMList_RowCancelingEdit" OnRowEditing="gvDMList_RowEditing" OnRowUpdating="gvDMList_RowUpdating" OnPageIndexChanging="gvDMList_PageIndexChanging" CssClass="table-bordered table-striped table-hover table-condensed" runat="server">
<Columns> <ItemTemplate>
<asp:LinkButton runat="server" CommandName="GetImage" ClientIDMode="Static" CommandArgument='<%#Bind("FileName") %>' ID="lnkAccountImage" OnClick="lnkAccountImage_Click" CssClass="btn btn-primary btn-xs" Text="Show Image"></asp:LinkButton></td>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" ControlStyle-CssClass ="btn btn-default" CausesValidation="false" ShowEditButton="true" ShowCancelButton="true"/>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>`
Second Update Panel
<asp:UpdatePanel ID="UpdatePanel2" ChildrenAsTriggers="true" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="container">
<asp:Image ID="imgAcnt" CssClass="img-responsive img-thumbnail center-block" AlternateText="Account Details Image" runat="server" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lnkAccountImage" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
I have two nested Gridviews, the parent is for Posts and child is for Comments. I want to update Post and Comments with a Time Interval so Im using an asp.net Timer. My problem is that a TextBox that is in the first Gridview loses focus when timer Ticks. I searched the web a lot, one possible solution was to take the textbox out of the UpdatePanel but in this situation I can't take out the textBox. Please help me, here is my code.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:Timer ID="Timer1" Interval="10000" OnTick="Timer1_Tick" runat="server">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<%--post GridView--%>
<asp:GridView ID="posts" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%--Comments Gridview--%>
<asp:GridView ID="comments" runat="server"></asp:GridView>
<%--a Textbox and bUtton For sending new Comment--%>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
protected void Timer1_Tick(object sender, EventArgs e)
{
posts.DataSource = GetData();
posts.DataBind();
}
I was going to type a similar answer to this, but it appears it has already been explained here - https://stackoverflow.com/a/22014420/2248290
The key point being: "An update panel takes focus away as it posts back"
I have a gridview with some textboxes and buttons inside the gridview. I want to use updatepanels when the buttons are clicked so that only one textbox is refreshed instead of the whole page. I tried to add my ScriptManager and UpdatePanel inside my gridview but I get errors saying the tags aren't recognized.
I've looked elsewhere on SO for solutions and others have said to place the whole gridview in an UpdatePanel. However, I don't want the whole grid to be updated (it's pretty lengthy). Is it possible to have individual UpdatePanels in my gridview?
EDIT:
Here is some code to go along with my question:
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="PCalendar" EventName="SelectedChange" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField HeaderText="QS">
<ItemTemplate>
<asp:TextBox ID="TextBox" runat="server" Text=' <%#Bind("PDate") %>' OnTextChanged="SetTextBox" AutoPostBack="True"></asp:TextBox>
<asp:ImageButton ID="PButton" runat="server" OnClick="ShowCalendar" ImageUrl="../images/calendarIcon.jpg" />
<asp:Calendar ID="PCalendar" runat="server" Visible="false" OnSelectionChanged="SetDate" ></asp:Calendar>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
Here is what it's going to sorta look like. Once you post your code, it will be easier to see how close you are and how to help you properly. But this is the general idea.
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="buttonOneID" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="buttonTwoID" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server">
<Columns>
//columns code here
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
I have two update panels at my ajax page. This is first time I'm using updatepanel and I don't know what is wrong. I think only btnFilter's Click event must trigger the second update panel's content but changing combo values (which also hides/unhides btnFilter button) makes second updatepanel change content (at least I see transferred data with firebug & second updatepanel blinks sometimes). Online here.
<asp:UpdatePanel ID="upComparison" runat="server">
<ContentTemplate>
Brand:
<asp:DropDownList ID="ddlBrands" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddlBrands_SelectedIndexChanged"
AppendDataBoundItems="true">
<asp:ListItem Value="" Text="Please select a brand..." />
</asp:DropDownList>
<asp:Panel ID="pModels" runat="server" Visible="false">
Model:
<asp:DropDownList ID="ddlModels" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddlModels_SelectedIndexChanged" />
</asp:Panel>
<asp:Panel ID="pButton" runat="server" Visible="false">
<asp:UpdateProgress ID="upMain" runat="server" DisplayAfter="100">
<ProgressTemplate><img src="/Assets/Images/loader.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:Button ID="btnFilter" runat="server" Text="Filter"
OnClick="btnFilter_Click" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="upList" runat="server">
<ContentTemplate>
<asp:Repeater ID="rProducts" runat="server">
<ItemTemplate>some code here</ItemTemplate>
</asp:Repeater>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnFilter" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
By default, every UpdatePanel will be refreshed during every asynchronous postback.
To change this behavior, set the UpdateMode property to Conditional.