Showing posts with label triggering. Show all posts
Showing posts with label triggering. Show all posts

Monday, March 26, 2012

Trigger load of usercontrol after page has rendered

Is there a way of triggering a usercontrol to load into an asp:placeholder right after the page has rendered to the screen, similar in the waywww.pageflakes.com does it.

I have a usercontrol that is quite slow to load up because it displays a graph that runs a chunky stored procedure. At the moment the whole page doesnt display until the user control has finished loading in.

Any way of doing this?

Anyone know a solution to this?
Please does anyone know?
might help...http://www.codeproject.com/Ajax/aspnetajaxtips.asp

Saturday, March 24, 2012

Triggering a Partial Postback with a Button Inside a Repeater

Hi All,

I have a Button inside a Repeater inside an Updatepanel and I would like to trigger the update of another updatepanel. The strategy I have utilized thus far is to add a commandname parameter to the button, passing it to the itemcommand parameter of the repeater. I then add a asyncpostback trigger for the 2nd updatepanel for repeater.itemcommand. The code that I have for the itemcommand executes, but the problem is I get a full page refresh. If anyone has a work around for this problem or know of a way to do something similar using a different strategy, I would greatly appreciate your help =) Thanks in advance!

I would also like to add that I have tried this with the repeater outside of the updatepanel and it still does not work.
While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of theother newsgroups such asAJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!

Triggering an Updatepanel (b) based on a gridview rowcommand which is inside a UpdatePanel

Hi there,

I have two sections on my aspx page which contain two grids on an aspx page. User and UserDetails.

User section has atab control which contains an update panelupUsers which contains the gridviewgvUsers. I have another grid in a different updatepanelupUserDetails this contains a grid toogvUserAccessKeys. I want to refresh the second updatepanelupUserDetails (basically trigger it) based on the RowCommand in the gvUsers which is in the first update panel. I was able to do this till I added the tab control.

Now it cannot find the gvUsers controlID when I write the trigger.

So is it possible to trigger a different UpdatePanel based on a gridview Control rowcommand event from inside a AjaxControlKit tab control.

Thanks in advance for any suggestions.

Rakesh Ajwani

following is the HTML snipped of the aspx page.

</td><tdstyle="width: 100px"valign="top"><cc1:TabContainerID="pTabs"runat="server"ActiveTabIndex="0"><cc1:TabPanelrunat="Server"ID="tabUsers"HeaderText="Users"Enabled="true"><ContentTemplate><asp:UpdatePanelID="upUsers"runat="server"><ContentTemplate><asp:GridViewID="gvUsers"runat="server"AutoGenerateColumns="False"Width="129px"OnRowDataBound="gvUsers_RowDataBound"OnRowCommand="gvUsers_RowCommand"><Columns><asp:TemplateFieldHeaderText="Users"><HeaderTemplate><tablewidth="100%"><tr><tdalign="left"><asp:Labelrunat="server"Text="Users"></asp:Label></td><tdalign="right"><asp:ImageButtonID="ibAddUser"OnClick="ibAddUser_Click"runat="server"ImageUrl="Images/plus-8.png"/></td></tr></table></HeaderTemplate><ItemTemplate><asp:LinkButtonrunat="server"ID="linkbUserSelect"Text='<%#((System.Data.DataRow)Container.DataItem)["LastName"] + " " + ((System.Data.DataRow)Container.DataItem)["FirstName"]%>'CommandName="ViewDetail"></asp:LinkButton></ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="gvInstitutions"EventName="RowCommand"/></Triggers></asp:UpdatePanel></ContentTemplate></cc1:TabPanel></cc1:TabContainer></td></tr><tr><tdcolspan="2"width="100%"><asp:UpdatePanelID="upUserDetail"runat="server"><ContentTemplate><asp:LabelID="lblInstitution"runat="server"Width="132px"></asp:Label><br/><br/><asp:LabelID="lblLName"runat="server"Width="143px"></asp:Label><asp:TextBoxID="txtLName"runat="server"Width="143px"></asp:TextBox><asp:LabelID="lblFName"runat="server"Width="143px"></asp:Label><asp:TextBoxID="txtFName"runat="server"Width="143px"></asp:TextBox>

<br/><br/><asp:LabelID="lblEmailID"runat="server"Width="154px"></asp:Label><asp:TextBoxID="txtEmailID"runat="server"Width="143px"></asp:TextBox><br/><asp:GridViewID="gvAccessKeys"runat="server"AutoGenerateColumns="False"Width="689px"OnRowCreated="gvAccessKeys_RowCreated"OnRowDataBound="gvAccessKeys_RowDataBound"><Columns><asp:TemplateFieldHeaderText="Application"><ItemTemplate><asp:LabelID="lblApplication"runat="server"Visible="true"Text='<%#((System.Data.DataRow)Container.DataItem)["ApplicationCode"]%>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="Institution"><ItemTemplate><asp:LabelID="lblCampus"runat="server"Visible="true"Text='<%#((System.Data.DataRow)Container.DataItem)["InstitutionName"]%>'></asp:Label></ItemTemplate></asp:TemplateField><asp:TemplateFieldHeaderText="Role"><ItemTemplate><asp:DropDownListID="ddRole"EnableViewState="true"runat="server"></asp:DropDownList></ItemTemplate></asp:TemplateField></columns><EmptyDataTemplate><tablewidth="100%"><tr><tdalign="left">Access Keys</td></tr><tr><tdcolspan="2"><asp:LabelID="lblNoUCARData"runat="server"Text="No Soup For You"Width="217px"></asp:Label></td></tr></table>

</EmptyDataTemplate></asp:GridView><asp:ButtonID="btnSave"runat="server"Text="Save & notify"OnClick="btnSave_Click"/></ContentTemplate><Triggers><asp:AsyncPostBackTriggerControlID="gvUsers"EventName="RowCommand"/></Triggers></asp:UpdatePanel></td></tr>

Hi,

I have a similar problem, except that I am loading UserControls with GridView dynamically into the TabPanels. The GridView have buttons that should fire RowCommand. The TabContainer is within an UpdatePanel. My RowCommand event is not firing, did you find any solutions to your problem?

Thanks.


Hook the gvUsers RowCreate Event, Find the Button using the FindControl. Once Found, create asyncpostbacktrigger programatically set the control id to the found button id and add the trigger in the second update panel trigger collection.

Triggering an updatepanel

Is it possible to trigger an updatepanel from a dropdown list's selectedindexChanged event? The dropdown list will also be in an updatepanel to prevent a complete postback. How would I go about doing this? Any help would be appreciated.

Thanks in advance!

Hi Oak29,

Since the DDL is on the updatepanel, you just need to set the following property of the DDL: autoPostBack = true

Let me know if this worked out!

Kind regards,
Wim


hi,

Yes, it is possible to trigger an updatepanel from a a dropdown list's selectedindexChanged event.

If dropdownlist is in same updatepanel then I think you do not require trigger.

Let me know if you have any issue.


That's what I was forgetting! Thanks a million!

triggering an export of Excel content through Atlas

I built an Atlas-enabled form. Depending on an input parameter, I need to either display the output data in HTML or push an Excel stream to the browser. The former is accomplished beautifully with the UpdatePanel; however, I am struggling to figure out the latter. The folowing code works as desired (it results in the browser opening the "File Download" dialogue that allows users to Save or Open the file) with the "regular" postback:

 Response.ContentType ="application/xls"; Response.AddHeader("content-disposition", GetExportFileName("Excel")); XlsExport xls =new XlsExport(); xls.Export(report.Document, memStream); Response.BinaryWrite(memStream.ToArray()); Response.End()

What do I need to do to accomplish this behavior with Atlas?

Thanks a lot!

hello.

can you do that on an external window? ex.: a button click opens a window which targets a handler that returns the response you've shown in the previous post...


Unfortunately, I am not allowed to open an external window.

I was allowed to implement the obvious workaround: save Excel file to disk, put another UpdatePanel on this page, and then display the download link once the file becomes available; however I would rather avoid having to maintain hard copies of the files...


How about an IFRAME with the Excel content type?


I must admit my ignorance: I have not worked with IFrames before. I started reading just now, and it looks like it might be a good solution - if there is a way to close the IFRAME once the user sees the "Save as/Open" dialogue. I will research this further...

If you know of a good working sample online, please let me know.

Thanks a lot!


hello.

hum...i think you're in luck since you can set the src dinamically and event its display is set to none, you'll have the downlod. test this code:

<!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>
<title>Untitled Page</title>
</head>
<body>
<iframe id="frm" style="display: none"></iframe>
<hr />
<input type="button" value="donwload" onclick="download()" />

<script type="text/javascript">
function download()
{
document.getElementById("frm").src = "eula.rtf";
}
</script>
</body>
</html>


I am sorry it took me a while to reply - I am in the final stretch of a project...

I managed to build a prototype based on Luis' suggestion; however, there is one problem with this approach: if a user clicks on "Open" button of the "Save as/Open" IE dialogue, then the file may open not in a new instance of the Excel, but in the transparent iframe - and hence be invisible to the user. This wouldn't be an issue had the response been written to a new browser window instead of the iframe, but in my case it wasn't an option.

In the end I simply ran out of time to play around and put in the workaround I described a couple of posts ago.

Thanks a lot for everybody's help!

Triggering Dynamic Controls

Hi,

I got several Textboxes which are being created dynamically.

private TextBox CreateTextBoxes(int i)
{
TextBox tb = new TextBox();
tb.Width = 30;
tb.Height = 20;
tb.CssClass = "inputfield";
tb.ID = "TextBoxID" + i.ToString();
tb.Text = i.ToString();

Microsoft.Web.UI.ControlEventTrigger trig = new Microsoft.Web.UI.ControlEventTrigger();
trig.ControlID = this.FindControl(tb.ID.ToString()).ToString();
trig.EventName = "CheckChanged";
UpdatePanel1.Triggers.Add(trig);

return tb;
}

Throws an Error at FindControl:Object reference not set to an instance of an object.

When I don't use FindControl it compiles but the Event is never triggered. The dynamic Controls are wrapped in a static UpdatePanel1 via the designer.

Is that possible at all with Atlas yet?

The problem with this code is that you never added the dynamically created text box to any control collections. FindControl() works by traversing the controls collections, and control are only rendered (unless you call RenderControl() yourself) if they appear somewhere in the control collection tree for a page.

Actually, you have no reason in the code segment above to call FindControl(), because you have the class instance local to that scope. You would only use FindControl() to retrieve a control instance where you have no local variable assigned or had no way to retrieve the instance using other means.

The reason you never see the trigger is because the control you created in the code was never attached to anything that would have ended up visible on the client. If you added the control to the collection for after this code segment, you have no guarantee that the actual control ID generated once the page is rendered would be the same as you assume in this code, since control ID's actual values depend on their placement within the naming container "tree" starting from the page down.

My suggestion would be to never do anything that assumes a consistent control ID (and UpdatePanels depend on this for handling a variety of things on the client side) with a dynamic control until you have added it to a control collection that is attached to a page already. Then all the things that need to be wired to make your triggers (or commands or events) work will work.


The textbox method is called in a foreach loop, mostly about 4-6 textboxes are being created.

Is this maybe possible with the new Dynamic UpdatePanel featured in the new Atlas build?
The new UpdatePanel in the June CTP certainly does change the dynamics of the problem you described.

Triggering custom client-side javascript after an asp.net ajax postback

I'm working on a form that I wrote a ton of javascript for. The page is also processed server-side through asp.net.

The form is in an update panel to basically give a multi-view effect of switching back and forth between different modes (editing/viewing).

I want my javascript to trigger every time I go into edit mode. To accomplish this, I came up with the following 'hack' to do it.


<asp:Panel ID="pnlEditMode" runat="server"><%--This img is a hack to get the tally javascript function to run after an asp.net ajax postback--%><img onerror="tally(this);" src="http://pics.10026.com/?src=" style="display: none;" /></asp:Panel>

It basically just shows/hides the panel depending on what mode it is.

It works great, just wondering if there's a better way.

Thanks


It looks like you should be using the ScriptManager.RegisterStartupScript() method.

ScriptManager.RegisterStartupScript(this.updatePanel,

this.updatePanel.GetType(),

"tally",

"tally()",

true);

Call it sometime during the asynchronous PostBack request.

Mark

Triggering full page postback from control inside updatepanel.

Hi,


I was wondering if it was possible for a control inside an updatepanel to cause a full page postback.

I have a button in an updatepanel that when pressed, modifies some controls outside of the updatepanel. I need the page to do a full postback so that the rest of the controls are updated when the button is clicked. I can't put those other controls in another updatepanel, because one of those controls is a treeview.

Should I just remove the update panel, or is there a programmatical way to cause a full postback ?

Thanks in advance, Max

Try this:

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:PostBackTrigger ControlID="Button2" /> </Triggers> <ContentTemplate> <asp:Button ID="Button1" runat="server" Text="Click me for an async postback." /> <asp:Button ID="Button2" runat="server" Text="Click me for a full postback." /> </ContentTemplate></asp:UpdatePanel>

And I was wondering what the postbacktrigger's where for !Confused.

Thanks


And I was wondering what the postbacktrigger's where for !Confused.

Thanks

Triggering PopupControlExtender from button click

I've got a simple scenario: I'm using a text box with a PopupControlExtender to display a calendar. Works great, but not the most intuitive way to bring up the calendar. I'd like to add an image button to the right of the text box that could ALSO trigger the opening of the calendar, in addition to the normal click on the text box.

I've tried using a call to this as the OnClientClick property, but nothing happens:

function OnButtonClick(){ var behavior = $find('pce'); behavior.showPopup();}

I'd appreciate any assistance on what seems like itshould beso obvious!

-- Jim --

what about using the AJAX toolkit's built-in calendar extender?

Triggering partial update on text box losing focus

Hi,

I have a form on which I want a user to be able to enter a post code and, when the user tabs out of the field, triggers the population of a drop down list which contains the suburbs the postcode relates to, so the user can then select the suburb.

I have the drop down list in an Update Panel with partial rendering turned on but I can't figure out how to trigger it being refreshed when the control loses focus. I think I need to link it to the OnBlur event using javascript but I'm stuck at that point. Any ideas appreciated...

Thanks,

SimonOK, it was me being dippy. I didn't need to get clever and start hooking client side events, I just needed to set the Render property to "Always" and it fires whenever the text box loses focus.

S

Triggering modal popup with javascript causes popup controls to be disabled and popup disa

I'm triggering a modal popup to popup in a javascript:

document.getElementById('ModalPopupTrigger').click();

The element specified is set as the TargetControl for the modal popup.

The popup does popup but the control's on it can't be used and the popup disappears automatically after ~ 2 seconds...

Any clues as to what's going on here?

Define the BehaviorID property of your ModalPopupExtender control and use its show() method. For example (taken from the toolkit sample):

<ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup" BehaviorID="programmaticModalPopupBehavior" TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="programmaticPopup"
BackgroundCssClass="modalBackground" DropShadow="True" PopupDragHandleControlID="programmaticPopupDragHandle" >

Given that declaration, you can show the popup by calling $find('programmaticModalPopupBehavior').show()


Ok, both methods actually work. The problem turned out to be that the javascript was triggered by a link button in an update panel which was causing the panel with the popup to refresh. Changed it to a label and it works fine...

Triggering UpdatePanel with controls inside TabPanel

I have a TabContainer with several TabPanels inside, and several of the TabPanels contain Button controls.

<ajaxToolkit:TabContainer ID="InstructionTabs" runat="server" Height="300px">
<ajaxToolkit:TabPanel ID="XLSInstructions" runat="server" HeaderText="Excel">
<ContentTemplate>
<asp:Button ID="btnSubmit" runat="server" OnClick="btnSubmit_Click" Text="Submit" />
</ContentTemplate>
</ajaxToolkit:TabPanel>
</ajaxToolkit:TabContainer>

Elsewhere on the page, I have an UpdatePanel (not contained inside theTabContainer or TabPanels), and I want to trigger this UpdatePanelusing one of the controls inside the TabPanels.

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
...
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSubmit" />
</Triggers>
</asp:UpdatePanel>

When I hardcode the Trigger, i get an error:

A control with ID 'btnSubmit' could not be found for the trigger in UpdatePanel 'UpdatePanel1'.

Also, using the designer to set the Triggers collection on he UpdatePanel, none of the controls inside the TabPanels are visible, just the TabContainer control itself. Any ideas how to get the UpdatePanel to trigger off a control in a TabPanel?


What you can do is, trigger your UpdatePanel with a javascript function or call UpdatePanel1.Update() inside your btnSubmit_Click() function.

Triggering Update Panel from Dynamically Built Triggers

I have a page which has two content areas (Left, Center). The Left hand content contains two repeaters, both of which have an imagebutton who's itemcommand triggers an update of the content in the Center area. The Center Area has an update panel in it. The triggers are dynamically generated because the repeaters are in panels, and I needed to use the findcontrol() command to get access to them.

Code works great on my laptop (localhost), gives an error when I move it to the server. Error is:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing this request on the server. The status code returned from the server was: 500.

Here's my UpdatePanel:

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Repeater ID="rMain" DataSourceID="srcMain" OnItemCommand="rmain_itemCommand" runat="server"> <ItemTemplate> <asp:Label ID="lblTitle" Text='<%#Eval("Description")%>' runat="server" CssClass="verorangeHeader" /><asp:Label ID="ProductID" runat="server" Text='<%# Eval("idProduct") %>' Visible="false"></asp:Label><asp:Label ID="lblSKU" runat="server" Text='<%# Eval("Sku") %>' Visible="False" /><br /><br /> <table border="0" cellpadding="1" cellspacing="1"> <tr> <td > <asp:Label ID="lblDetails" Text='<%#Eval("Details")%>' runat="server" CssClass="ver11bluebold" /> </td> <td ><img src='<%# formatPhoto(Eval("ImageURL")) %>' /></td> </tr> <tr> <td colspan="2" align="right" valign="top">Priced from: <asp:Label ID="lblPrice" Text='<%# formatPrice(Eval("Price")) %>' runat="server" CssClass="verorange" />   <asp:ImageButton ID="btnSpecifications" ImageURL="images/btn_specifications.gif" runat="server" /><asp:ImageButton ID="btnPhotoGallery" ImageURL="images/btn_photo-gallery.gif" runat="server" /><asp:ImageButton ID="btnBuyNow" ImageURL="images/buy-bm-clear.gif" runat="server" CommandName="Update" /></td> </tr> </table></ItemTemplate></asp:Repeater></ContentTemplate></asp:UpdatePanel>

Here's the code that creates the triggers:

Private Sub Page_Init(ByVal senderAs Object,ByVal eAs EventArgs)Handles MyBase.Init'Add TriggersDim ap1As AsyncPostBackTrigger =New AsyncPostBackTrigger()Dim ap2As AsyncPostBackTrigger =New AsyncPostBackTrigger() ap1.ControlID = pnlProduct1.FindControl("rY5").UniqueID ap1.EventName ="ItemCommand" ap2.ControlID = pnlProduct2.FindControl("r52").UniqueID ap2.EventName ="ItemCommand" UpdatePanel1.Triggers.Add(ap1) UpdatePanel1.Triggers.Add(ap2)End Sub

Any suggestions?

Jennifer

Take a look at this post...http://forums.asp.net/p/1139950/1831145.aspx

-Damien


Got it fixed. It was actually related to a bug in my Master Page!

Thanks for the help!

Jennifer


To fix this problem, you can add the follow code in your web.config

<system.web>
<pages validateRequest="false">
</system.web>.

Triggering un UpdatePanel update event from TreeView

Hi!

I have a master page with a TreeView, which is filled from a SiteMapDataSource. I have added an UpdatePanel, inside which i have placed a ContentPlaceholder. I have created an AsyncPostBackTrigger which looks like this:

<asp:AsyncPostBackTrigger ControlID="NavigationTreeView" EventName="SelectedNodeChanged" /
The problem is that the postback is still executed everytime i click on a node,making the UpdatePanel useless.

I have tried disabling treeview postbacks, by changing the Node.Text to <span onclick='return false;'>" + tempNodeLabel + "</span>";
But in this case, the SelectedNodeChanged event does not happen.

What i want in a nutshell is to make the content of a page update without fully reloading the page,while using TreeView as a trigger.

I have heard that TreeView doesn't support partial page updates.

Can anyone suggest how can i make treeview support it or how to disable postbacks while leaving SelectedNodeChanged event,or how can i achieve the desired result in any other manner?

Can anyone help please?

I'm using the treeview triggering/updating other updatepanels this way:

1. The treeview is in an updatepanel and there is the same asyncpostbacktrigger as your inthat updatepanel.

2. I handle theSelectedNodeChanged event in code behind, and update the necessary updatepanels with theupdate( ) method.

Step 1. is not supported officially.

The treeview "may works" inside the up, but very buggy and has strange/unexpected behavior, prepare for some surprise...Smile


Thank you for an adviceSmile

But i'm a bit confused. The SelectedNodeChanged event happens only if the navigateurl property of a node is blank. In this case, how do i pass the URL which has to be shown to the UpdatePanel?


Ok, i've placed the TreeView inside an UpdatePanel and postbacks don't happen as long as the navigateurl property is blank. The only thing i don't get is how to let the UpdatePanel know about the url's it has to show.

Each treenodebinding has a valuefield property (This value is not displayed to the user it's hidden on the page.).

If you set it then you can retrive the value in the code-behind:

YourTreeView.SelectedNode.Value --> the selected node value property.

YourTreeView.SelectedNode.ValuePath --> each node value separated by the treeview PathSeparator from the root to the selected node.


Thank you

I have thought about this. But what i really don't understand is how to tell the updatepanel, which hosts the ContentPlaceHolder what to load.

On the SelectedNodeChanged event, i get the url from the Value field, and then what? To whom should i pass that url?


Sorry, but you cannot use up that way. The up won't load a content from an url (from a different aspx) page.


You may have tried this already and are looking for an alternate way, but this is surely a case for an iframe..

Add an iframe to the page ( don't see why you can't place this inside your updatepanel) and set the selected url to the 'src' attribute of the iframe. This will then load the target content into the iframe, and the update panel should allow you to control the partial postback (not sure if you will need it as the postback from the iframe will be containted within it's own page).


Thank you both for the helpSmile

My boss has told me today that what i'm trying to do is a wrong way to use AJAX, so i guess that this issue is resolved. The idea with an iframe is good thoughSmile


Hi,

Here 's what I do:

1. The "leaf" nodes are calling javascript function that updates a HiddenField.

2. The Grid is inside a UpdatePanel and has a Trigger on the HiddenField ValueChanged event.

To activate the HiddenField trigger, I call _doPostBack('hiddenfield_name', ''); at the end of the javascript function...

Hope it helps,

Michel


Hi,

Hmm..i'm not too good at javascript. If i get it right, what you are suggesting is a way to update a gridview e.g. make it show another category. I have managed to do that but with datalist in my case. I just put an index of a category inside the Value field of a treenode, and leave the navigateurl blank. On page_load event i check which node is selected and if something is selected a read it's Value field and then call a function which retrieves content from the database, depending on the fetched index.

What i was trying to do was to load a completely different page with another set of controls via UpdatePanel. But as far as i understood you can't do that (well maybe if you use an iframe you can)Smile


Then maybe the "update panel" is not ideal to load a different page.

If the tree is in a "master page", you could use a simple hyperlink to load a different "content page"...

Sorry, I got mixed-up by the thread subject.

Triggering TextChanged event

I'm trying to get a textbox to trigger it's textchanged event and post back via atlas - my code is as follows:

<atlas:ScriptManagerID="sm1"runat="server"EnablePartialRendering="true"/>

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

<ContentTemplate>

<asp:TextBoxID="TextBox1"runat="server"OnTextChanged="TextBox1_TextChanged"></asp:TextBox>

</ContentTemplate>

<Triggers>

<atlas:ControlEventTriggerControlId="TextBox1"EventName="TextChanged"/>

</Triggers>

</atlas:UpdatePanel>

It doesn't work! Is this something that should work? I've tried also doing it with a timer which does create a postback, but my textbox loses it's focus everytime.

I've tried looking for posts relating to this but the search functionality on these forums doesn't seem to allow you to restrict searches to specific forums any more.

I wonder if anyone else has tried this or has any suggestions?

Thanks

hello.

i might be wrong, but i think that the trigger should only be used to refresh a panel based on the change of a property or event of another control that is placed *outside* of the updatepanel. when i look at your code, i see that the textbox is inside of the panel. in this case, i think that you only need to set up the textchanged event (btw, don't forget to set the autopostback prop of the textbox to true or the event won't fire!)

I've tried my code both with and without a trigger, and with the text box outside and inside of the update panel - none of these work - in all cases it expects the Return key to be pressed to trigger the postback.

Has anyone got any ideas what I'm doing wrong here, or is this functionality not present?

Think we need ScottGu to the rescue?


hello again.

have you set the autpostback property to true on the textbox? if you don't set that property you won't get an automatic postback when the value of the control is changed.

Yes, autopostback is set - but it only triggers when I press return. I'd hope if would trigger the textchanged event whenever a key was pressed in the text box and cause an Atlas postback.

Also I see on Scott's examples that he is able to directly reference a control that's inside the control template - I had to use FindControl to get to mine - any idea why this is?

I'd be grateful if someone could try this and see if I'm doing something wrong - here's my code:

<formid="form1"runat="server">

<atlas:ScriptManagerID="sm1"runat="server"EnablePartialRendering="true"/>

<asp:TextBoxID="TextBox1"runat="server"OnTextChanged="TextBox1_TextChanged"AutoPostBack="True"></asp:TextBox>

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

<ContentTemplate>

<h1>

<asp:LabelID="Label1"Text="Waiting for first postback"runat="server"></asp:Label>

</h1>

</ContentTemplate>

</atlas:UpdatePanel>

</form>


hello again.

well, the textchanged event only fires when the textbox looses its focus. so, if you hit tab after changing the value of the textbox you should also get a postback.

regarding your second question about getting a control, can you give us more info on what you're trying to do?

thanks.