Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Wednesday, March 28, 2012

UpdateProgress not reacting to LinkButtons in MultiView and FormView

I have a Content Page with two UpdatePanels. The first one has a FormView inside it and second one has MultiView with several Views. In each of this views I have a GridView in it. I change the views by LinkButtons that are also in the same UpdatePanel.

My problem is that none of the PostBack events in the UpdatePanels seem to fire the UpdateProgress. However, if I add a third UpdatePanel with a Label and a Button whith the following code, it does react to the Button click.

ProtectedSub btnTest_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)

System.Threading.Thread.Sleep(3000)

lblTest.Text = DateTime.Now.ToString()

EndSub

But it still won't react to the events in the other two panles. Am I doing something wrong? All help would be greatly appriciated.

Thank you.

One more thing:

I can also move the Label and the Button to one of the exisiting UpdatePanels and the Button Click event does fire the UpdateProgress correcctly.


I also have two DropDownLists in the FromView (located inside a UpdatePanel) with PostBack events. Shouldn't that trigger the UpdateProgess?

Anyone?Tongue Tied

Thank you.


I did some futher testing and noticed if I copy the following in the LinkButton Click Sub, the UpdateProgress shows for that 3 seconds:

System.Threading.Thread.Sleep(3000)

So basically it seems only to work when sleeping but not when doing actually something, like sorting data in the GridView.Huh?

Is there anyway to fire the UpdateProgress manually?


Found an interesting link that almost (but not quite) handels my problem:

http://smarx.com/posts/why-the-updateprogress-wont-display.aspx


I tryed to use UpdatePanelAnimationExtender instead and found out a strage thing. When using the following code clicking the button that does that sleep thing, everything works fine. But when I do any other action on the that UpdatePanel (click a LinkButton that chages the active View, sort data in the GridView) the OnUpdating animation (FadeOut) only begins and then stops for several seconds until the data is rendered and then the OnUpdated animation (FadeIn) runs entirely. Strange!Hmm

<cc1:UpdatePanelAnimationExtenderID="UpdatePanelAnimationExtender1"runat="server"TargetControlID="upnDataTabs">

<Animations>

<OnUpdating>

<FadeOutDuration="1"Fps="40"/>

</OnUpdating>

<OnUpdated>

<FadeInDuration=".5"Fps="20"/>

</OnUpdated>

</Animations>

</cc1:UpdatePanelAnimationExtender>

I seem to be talking to myself here... MUST TAKE MY MEDICAIONIndifferent

UpdateProgress throws javascript error when contained in a Panel with visible = false

If you put a UpdateProgress control inside a Panel control with visible=false, you will get a javascript error that is cannot find the elements used for the update progress functionality.

Anyone, seen this before and know of a workaround?

I get the same result in a MultiView when the UpdateProgress control is contained in a view that is not the current view.

Thanks,

Ryan

When you set Visible equal to false the HTML contained therein does not get rendered at all. You shouldn't need to explicitly hide the UpdatePanel as it should hide itself unless an Atlas postback is in progress.

If you do need to hid it, set the style of the panel to "display: none" and leave it visible. That way the HTML will be rendered but not shown on screen.


Thanks for the suggestion on display: none. This will work for Panel controls, but it won't work for pages using the MultiView control. I guess I'll have to get rid of MultiView and create several separate panels wnd manually control which one is shown and which ones are diplay: none.

Monday, March 26, 2012

Updating control in UserControl inside of UpdatePanel

Hello,

I have a page that contains a UserControl. Most of the page (including the UserControl) is wrapped in an UpdatePanel. When an AJAX event on the page occurs, I'd like to call a method inside of the UserControl to update a label. Problem is, when I do this, the page adds a new copy of the UserControl's contents (with the updated label) at the bottom of the page rather than refreshing the existing copy. Any idea what I'm doing wrong?

Thanks.

Are you dynamically creating the controls in the user control or dynamically creating the usercontrol itself? Posting your source code would be helpful.


Nope, no dynamic loading of anything. The page just looks something like this:

<asp:ScriptManagerrunat="server"ID="ScriptManager1"></asp:ScriptManager>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<Custom:HotelDetailsrunat="server"ID="HotelDetails1"/>

</ContentTemplate>

</asp:UpdatePanel>

And there's an event in the code-behind of the page:

ProtectedSub DateChanged(ByVal srcAsObject,ByVal eAs Infragistics.WebUI.WebSchedule.WebDateChooser.WebDateChooserEventArgs)

HotelDetails1.UpdateRooms(wdcCheckIn.Value, wdcCheckOut.Value)

EndSub

And in the UserControl, there's a public method like this:

PublicSub UpdateRooms(ByVal StartDateAs DateTime,ByVal EndDateAs DateTime)

litName.Text = StartDate.ToShortDateString()

EndSub


I split the page into two UpdatePanels...one for the even firing controls and one for the UserControls that get updated and that seems to resolve the issue.

Updating from a template control

Hello,

I'm having an issue getting a Label inside of an UpdatePanel to change when a button in a GridView PagerTemplate is clicked. I have a label that I am showing the Page X of Y count. I have defined the First, Next, Previous and Last commands as Buttons in the PagerTemplate. The problem is that when I click the button, in the code behind I am setting the Text of the label, but it is not changing on the page. I cannot register the button in the UpdatePanel Triggers, because it is in the PagerTemplate. How can I make the label update from the button?

Thanks,

Nick

If I set up a Trigger on the gridview's databound event, will this cause the label to update?

Thanks,

Nick


You don't need to go that way.

Just do ScriptManager.GetCurrent( this.Page ).RegisterAsyncPostBackControl( control );

You have to do this on each post though. (ItemCreated will get fired each post)


Would this be done in the Pages Load event, or the button's click event?

Thanks,

Nick


Subscribe to the ItemCreated event in your grid and do it on all the rows. (e.Item).

Saturday, March 24, 2012

upgrading to Atlas 2.0

I upgraded a site to Atlas 2.0.
I now have a problem with an autoextender inside of a user control. In the user control, I am setting one of 6 textboxes visible depending upon the choice made in a dropdown list. Each textbox has an autoextender attatched to it. When the user starts typing, each autoextender calls it's own function in a web service and autofills the textbox.

This worked using 1.0 of Atlas with no errors

Now, When I browse to the page with the user control, I get the following error:
Assertion Failed: Could not find an HTML element with ID "CtlSearchLims1_txtStrain" for contorl of type "Sys.UI.Control" Break into Debugger?
Whether I click OK or cancel, nothing happens.

The ID of the Control is "CtlSearchLims1" and the first textbox on the control is txtStrain.
Every time I generate a postback I get the above mentioned message. For some reason, it is putting the control ID and the textbox ID together.

When I downloaded Atlas 2.0, I blew away the 1.0 download, so I either need to get this fixed or get a copy of the 1.0 download and go back to that version.

Thanks,

Faronwhere did you get atlas 2.0? since thereisn't even a 1.0 version. Atlas is still in beta and has a versionnumber like 0.0.0.0.0..0.0.0.0.1.2 or so.
So what do you mean? You upgraded from the March CTP to the April CTP?Or do you mean dat you upgraded from ASP.NET1.0 to ASP.NET 2.0?

I went from the previous version that has a Microsoft.Web.Atlas.dll in the bin folder of 167 kb (2/3/2006), to the latest version that has a Microsoft.Web.Atlas.dll of 1872 kb (4/6/2006).

I received no errors on the first version and it started failing when I moved to the current download of Atlas.

Faron


I went from the previous version (OF ATLAS) that has a Microsoft.Web.Atlas.dll in the bin folder of 167 kb (2/3/2006), to the latest version that has a Microsoft.Web.Atlas.dll of 1872 kb (4/6/2006).

Everything is on ASP.NET 2.0!

I received no errors on the first version and it started failing when I moved to the current download of Atlas.

Faron

upload doesnt work inside Update Panel.

I put following code inside an UpdatePanel. The upload control doesn't work.
If I remove the updatepanel, the it is OK.

<input id="fileUpload" type="file" size="60" name="fileUpload" runat="server" />
<asp:Button ID="btnUpload" runat="server" Text="Upload"></asp:Button>You're right, this is a known issue. Do a search.
Hi~ One walk around to this is to put an iframe in update panel and do the upload in the page held in that iframe~

I'm sorry, but has anybody found the solution for this problem?


File uplod is not suposed to work within update pannel.
Solution how to overcome this behavior:
http://msmvps.com/blogs/luisabreu/archive/2006/12/14/uploading-files-without-a-full-postback.aspx

Maybe this helps...

Or add a button beside file upload control with name "Upload file" and add postback trigger to update pannel for that button click event. File will be uploaded when this button is pressed but page then will do normal postback

Mindaugas

Uploading a file in a updatepanel

Basically, I am trying to do an upload inside the updatepanel. (Ajax, C#, Visual Studio 2005)

I don't think it's possible to do it without full page post back.. (If I am wrong, please let me know how!!)

So, I decided to put a not-visible button in master.master page. The code follows below.

<%@dotnet.itags.org. Master Language="C#"
AutoEventWireup="true"
CodeFile=" Master.master.cs"
Inherits="Master" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<!--General Stylesheet-->
<link rel="stylesheet" href="http://links.10026.com/?link=css/gen_style.css" type="text/css" />
</head
<body style="border:0px; margin:0px;"
<form id="submitTicketForm" method="post" runat="server" enctype="multipart/form-data">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="MainLoginPanel" runat="server">
<ContentTemplate
<!--Top Logo-->
<div class="headerTop">
<div id="header">
<div class="logo"></div>
<div class="login">
<asp:Panel runat="server" ID="LogOutPanel">
<asp:Button OnClick="LogOut_Click" runat="server" ID="LogOut" Text="Click here to logout" Width="142" CssClass="myBtn" />
</asp:Panel>
</div>
</div>
</div
<!--Tab_Panel-->
<asp:Panel runat="server" ID="Tab_Panel">
<div class="tabTop">
...
</div>
</asp:Panel>
<div class="contentplaceholder">
<asp:contentplaceholder id="mainContent" runat="Server"></asp:contentplaceholder>
</div>
<asp:Button id="UploadButton" Visible="false" runat="server" Text="Submit" CssClass="myBtn" OnClick="sendData" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="UploadButton" />
</Triggers>
</asp:UpdatePanel
<!--Page Footer-->
<div class="footer">Footer</div>
</form>
</body>
</html
Then the below is the code for NewTicket.aspx. If I press the btn_sendData button, I need to trigger the UploadButton button in the master's page.

<%@dotnet.itags.org. Page Language="C#"
MasterPageFile="~/Master.master"
AutoEventWireup="true"
CodeFile="NewTicket.aspx.cs"
Inherits="NewTicket"
Title="SPN Ticketing System - Submit a New Ticket" %
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %
<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="Server">
<asp:FileUpload ID="fileChoose" runat="server" />
<asp:Button id="btn_sendData" runat="server" Text="Submit" CssClass="myBtn" OnClick="TriggerMasterUploadBtn" />
</asp:Content
Now, the below is the partial code from NewTicket.aspx.cs.

protected void TriggerMasterUploadBtn(object sender, EventArgs e)
{

Control btnControl = Page.Master.FindControl ( "UploadButton" );
Button btn = (Button)btnControl;
//I have the control but I don't know what to do!
}

I've been pulling my hair for hours for this thing.
Your help is GREATELY appreciated!
Thank you again.

It is not possible to do a file upload without doing a full post back. If you have the fileupload inside the update panel you will need to add a trigger to the button that will take care of the uploading. There have been many posts on this forum about this, and some have some good work arounds.

http://forums.asp.net/thread/1444713.aspx

There is alink on one of the threads that is to an MSDN page that listed all the controls that currently do not work with update panel but I can't seem to find it. If anyone does, please post it here.

Uploading File doesnt work when using UpdatePanel!

Hi,

Uploading files works fine but when i tried to include everything inside the UpdatePanel then i can no longer upload. The reason is that on my PostBack, the input values(file1, file2, file3, file4) have empty values..

<tableborder="0"cellspacing="0"cellpadding="0"style="border-collapse: collapse;">

<trid="fileInput1"><tdalign="left"class="VerdanaXXSmallBlue">1) </td>

<td><inputid="file1"type="file"runat="server"class="VerdanaXSmallBlue"style="width: 100%"/></td></tr><trid="fileInput2">

<tdalign="left"class="VerdanaXXSmallBlue">2) </td>

<td><inputid="file2"type="file"runat="server"class="VerdanaXSmallBlue"style="width: 100%"/></td></tr><trid="fileInput3"><tdalign="left"class="VerdanaXXSmallBlue">3) </td><td><inputid="file3"type="file"runat="server"class="VerdanaXSmallBlue"style="width: 100%"/></td></tr><trid="fileInput4"><tdalign="left"class="VerdanaXXSmallBlue">

4)

</td><td><inputid="file4"type="file"style="width: 464px"class="VerdanaXSmallBlue"runat="server"/></td></tr></table>

Hi Kiril,

The Ajaxdocumentation states that theFileUpload control is not compatible with partial-page updates and is therefore not supported inside an UpdatePanel. To use aFileUpload control inside anUpdatePanel control, set the postback control that submits the file to be aPostBackTrigger for the panel.

HTH


cool. thanks

UploadPanel and Session problem

I have an UpdatePanel and a simple asp Button inside it, that produces asynchronous postbacks to server. Server-side onButton_Click event handling is a lasting operation(about 5 sec) thats why if async postback is in process user should be able to go to another page or make any actions.

Everything works fine unless the session object is used anywhere in application(not even in the button on click handler!). If session object is used IE doesnt allow you to make any type of postback while current async postback is in progress.

Has enyone encountered such a problem? Please Help!

Hi,

Asp.net is typical a multi-thread environment, and for thread safety, page requests using session state internally use a ReaderWriterLock to manage access to the session state.So, the second request will not be able to access it untill the lock by the previous request is released.

It should work if the second page doesn't make use of session or use <a> tag to perform redirection.


Hope this helps.

Wednesday, March 21, 2012

Urgent Please Help

Thanks for taking time in reading this thread.

I have Gridview contorl inside Update panel

Gridview in dynamic and I have added EditTemplateField to this grid.

When I click on Edit button , page flickers and it does not go into edit event.

I am not using sqldatasource or objectdatasource, I have custom classes.

What do you think is the problem ?

Again Thanks.

For reference here is the code

**************************************Code to create Edit button**************************************

TemplateField templateFieldEdit =newTemplateField();

templateFieldEdit.ItemTemplate =newReportViewHelper(ListItemType.Item, ReaderColumn[ReportViewHelper.ColumnDBName].ToString().Trim(),"Command");

**************************************Design Edit Button**************************************

elseif (_columnControlType =="Command")

{

ImageButton edit_button =newImageButton();

edit_button.ID ="edit_button";

edit_button.ImageUrl ="~/Images/edit.gif";

edit_button.CommandName ="Edit";

edit_button.Click +=newImageClickEventHandler(edit_button_Click);edit_button.ToolTip ="Edit";

container.Controls.Add(edit_button);

}

************************************** this is the method that is not triggering *************************************

void edit_button_Click(object sender,ImageClickEventArgs e)

{

}

Take a look at this articlehttp://aspalliance.com/1125_Dynamically_Templated_GridView_with_Edit_Delete_and_Insert_Options. It's real helpful for creating dynamic templates...

-Damien

Urgent Please! Button CausesValidation

Hi,

I have three buttons inside a tabcontainer which is inside an update panel. Two buttons have causesValidation="False" and when clicked, the button event fires. One button has causesValidation="True" and the event does not fire. If I change the causesvalidation to False, the event fires.

Any help on this would be greatly appreciated.

Thanks

Do you have any validation controls on the page?!
If yes, and you wish to continue your validation set the ValidationGroup of each validation control to something, and set the ValidationGroup of your button who causes the validation to the same ValidationGroup you set for validators.

Note that CausesValidation enforce the control to validate the page, and if you set validation group, it will invoke only validators who have the same validation group.


I shall try setting the ValidationGroups and let you know.

Thanks for quick response. Appreciate it.


YES, Setting Validation Groups did the trick.

Thanks


Great,
nice to know that, good luck with the rest

urgent: Modal popup Extender is not closing after validation fires

I have an edit modalpopupextender inside the gridview that appear when linkbutton is clicked all of this inside an update panel and its working great.

when the modalpopupextender popsup i have two buttons "Close" and "Save" button and when the user click on "Close" it closes the modalpopupextender - again its working great.

but the problem isthat, when i click on "Save" button it FIRES validation and in the modalpoupextender i have twocustomvalidation controlsthat validates whether the user have check at least one checkbox or not so when the user hit on "Save" button the validation fires whic is great so far butwhen i clik on "Close" button its not closing my modalpopuextender ?

here is my close button looks like:

<ajaxToolkit:ModalPopupExtender ID="mpePerson" runat="server" TargetControlID="btnHiddenPerson"
PopupControlID="pnlPerson" OkControlID="bModalDialogCancel"CancelControlID="bModalDialogCancel" BackgroundCssClass="modalBackground"
PopupDragHandleControlID="PersonCaption">
</ajaxToolkit:ModalPopupExtender>

<asp:ButtonCausesValidation="false"ID="bModalDialogCancel" runat="server"Text=" Close "ToolTip="Close this window"/>

what is going on here?

You have your OkControlID and your CancelControlID both pointing to the same button ('bModalDialogCancel').

------------------
When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


i fixed myself, i was passing the wrong id.

thanks.