Showing posts with label controls. Show all posts
Showing posts with label controls. Show all posts

Wednesday, March 28, 2012

Multiple Popup Controls in PopupControlExtender

This is the code i have.

<atlasToolkit:PopupControlExtenderID="PopupControlExtender1"runat="server">

<atlasToolkit:PopupControlPropertiesPopupControlID="Panel1"Position="Bottom"TargetControlID="txtFrom"/>

<atlasToolkit:PopupControlPropertiesPopupControlID="Panel1"Position="bottom"TargetControlID="txtTo">

</atlasToolkit:PopupControlProperties>

</atlasToolkit:PopupControlExtender>

I get the following error message. But, if i remove one of the popupcontrols it works fine. AtlasControlToolkit version is 1.0.60914.0. What am i doing wrong.

Couldn't get extender properties on extender PopupControlExtender1. Make sure the ID is spelled correctly and the control is on the page.

Please include the complete error information and post a complete, simple sample page if you could.

Multiple rating controls on one page malfunction

Hi,

When I put multiple rating controls on a page, only the first one works. The others act as if they has set ReadOnly = true. I've tried putting them on different pages, inside different update panels, inside the same update panel, outside update panels, setting ReadOnly = false for each one, setting the same OnChanged function, setting different OnChanged functions. Same thing every time. The first one works just fine and calls its OnChanged function. All the rest don't respond to mouseOver, and don't call their OnChanged. But their 1-5 tooltips do pop up, so they are breathing. Please help!

Any thoughts? Am I the only one this happens to? I'm new to ajax, so please point out the obvious...

I have the Script Manager on a master page. I set the .css to the one given in AjaxControlToolkit\SampleWebSite for simplicity. I also tacked ajax onto this project by copying web.config info ala joe's video- did I maybe miss something there?

Here's the code-

<asp:UpdatePanel id="upFilter1" runat="server">
<contenttemplate>
<cc1:Rating ID="rateFilter1" runat="server"
BehaviorID="RatingBehavior1"
CurrentRating="2"
MaxRating="5"
StarCssClass="ratingStar"
WaitingStarCssClass="savedRatingStar"
FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyRatingStar"
OnChanged="ContentFilterChanged"
style="float: left;" Height="6px" Width="65px" />
</contenttemplate>
</asp:UpdatePanel
<asp:UpdatePanel id="upFilter2" runat="server">
<contenttemplate>
<cc1:Rating ID="rateFilter2" runat="server"
BehaviorID="RatingBehavior1"
CurrentRating="2"
MaxRating="5"
StarCssClass="ratingStar"
WaitingStarCssClass="savedRatingStar"
FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyRatingStar"
OnChanged="ContentFilterChanged1"
style="float: left;" Height="6px" Width="65px" ReadOnly=false />
</contenttemplate>
</asp:UpdatePanel>


Again, first one works fine, second one doesn't respond.


I think it's because your BehaviorID IDs are the same. I'm having the same problem, but I'm generating my Ratings in a while loop, so cannot change them.


Anyone got any idea how I give each Rating control a unique BehaviorID?


Yep, that did it. It works with the basic appearances- now to hook them up to actually function. If it changes the functionality I'll check back in.

What's wrong with the loop? Can't you just set

NextRating.BehaviorID = NextID

NextID += 1



I've since found that you don't use while loops to output multiple rows of returned data anymore. The new method is to use an ASP Repeater and bind it to a dataTable. This magically sorts the IDs out for you by itself.

multiple tabs which get dynamically filled with user controls

Hey guys, i'm new to this stuff. I've searched for hours but couldn't find an appropriate solution for my problem. i'm sure that it's not a big deal, but somehow i can't figure out how to solve this.

the problem is the following:

I have a website with a menu and other not so importent content on it. There is also a TabContainer inside an UpdatePanel.

I want to implement multiple Tabs which contain a single UserControl for each Tab. These Tabs should be add -and removable. So when i click on button of the menu a new Tab opens up and gets filled with the correct User Control.

I've tried the following:

Dim myTab As New AjaxControlToolkit.TabPanel
Dim Member As System.Web.UI.Control = LoadControl("~/Member.ascx")
myTab.Controls.Add(Member)
TabContainer1.Tabs.Add(myTab)

Somehow i get a tab, but i have to click on the tab to display my user control at the same time i get an ArgumentOutOfRangeException followed by a time out.

Any idea what i've done wrong?

thanks in advance!

Need to see your code if possible


Yes, please show us a simple repro. It's hard to tell why from your current description.


It's more a question in general. Is it correct that i only place the tabcontainer on my page and add the tabpanels dynamically via my code behind file?..like already mentioned in the post before:

Dim myTab As New AjaxControlToolkit.TabPanel
Dim Member As System.Web.UI.Control = LoadControl("~/Member.ascx")
myTab.Controls.Add(Member)
TabContainer1.Tabs.Add(myTab)

What else do I have to take care of when I want to implement add and removeable tabs? i think it's not possible to add and remove updatepanels at runtime right?

I figured out that the "ArgumentOutOfRangeException" disapears if I put the code above in the page init event, but that doesn't really help me at all, because the Tabpanels should be created when i click on one of my menu buttons.

thanks in advance!


Generally, the code and logic you've shown is correct.

I'm asking for a simple repro because I'm not sure where is the exception thrown, and suspect this might have something to do with the page life cycle.


I fixed the exception by adding the code into the page init event (the user control was loaded into a tab before it existed). i'm sure your're right that it has something to do with my page life cycle. The question is: is it possible to remove and add the same tab during the page life cycle?

Thanks for the quick reply!


muffos:

The question is: is it possible to remove and add the same tab during the page life cycle?

Yes, of course you can.


Hallo again,

The page works perfect if I add the TabPanel with the UserControl inside during the page_init event, but that is not a fitting solution. If I put the code that adds the Tabpanel in a button click event the tab is not displayed and I get an error like the following (translated error message):

An Error occured during the validation of the ViewState-MAC. If this apllication was hosted by a webfarm or a cluster make sure that the <machineKey> configuration indicates the same validationKey and validation algorithm. AutoGenerate can not be used in a cluster.

Any idea why i get this error?

Could you give me a short example of a aspx page where you at and remove ajax tabs by clicking on a button?

I really appreciate your help!


I found an older thread where they were discussing the same problem that I have right now.

http://forums.asp.net/p/1077423/1595745.aspx

They didn't find a solution either. Ideas on this?!?!


<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void LinkButton1_Click(object sender, EventArgs e) { TabContainer1.Tabs.RemoveAt(TabContainer1.ActiveTabIndex); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1"> <ContentTemplate> Tab 1 </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2"> <ContentTemplate> Tab 2 </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3"> <ContentTemplate> Tab 3 </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">Remove Current Tab</asp:LinkButton> </form></body></html>
Is this what you need?

Well, I managed to add one dynamically created tab with a user control inside without getting any error. Somehow i'm not able to add any more Tabs.

Here is my current code:

PartialClass _Default

Inherits System.Web.UI.Page

Private _memberAs System.Web.UI.Control

Private _TestSeite2As System.Web.UI.Control

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

TimeLabel.Text = DateTime.Now

EndSub

ProtectedSub LinkButton1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles LinkButton1.ClickDim myTabAsNew AjaxControlToolkit.TabPanel

TabContainer1.ActiveTabIndex = 0

myTab.Visible =True

EndSub

ProtectedSub LinkButton2_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles LinkButton2.ClickDim myTab2AsNew AjaxControlToolkit.TabPanel

TabContainer1.ActiveTabIndex = 1

myTab2.Visible =True

EndSub

ProtectedSub TabContainer1_Init(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles TabContainer1.Init

If Page.IsPostBackThen

TabContainer1.Tabs.Clear()

_member = LoadControl("~/Member.ascx")

Dim myTabAsNew AjaxControlToolkit.TabPanel

myTab.HeaderText ="Tab 1"

TabContainer1.Tabs.AddAt(0, myTab)

myTab.Controls.Add(_member)

EndIf

//// i know that the following loop doesn't make any sence, it's just the result of my frustration :)

If Page.IsPostBackThen

_member = LoadControl("~/Testseite2.ascx")

Dim myTab2AsNew AjaxControlToolkit.TabPanel

myTab2.HeaderText ="Tab 2"

TabContainer1.Tabs.AddAt(1, myTab2)

myTab2.Controls.Add(_member)

myTab2.Visible =True

EndIf

EndSub

EndClass

//////////////////////and here my aspx page:

<%@.PageLanguage="VB"AutoEventWireup="true"CodeFile="ItellU.aspx.vb"Inherits="_Default"enableEventValidation="false"viewStateEncryptionMode="Never"enableViewStateMac="false" %>

<%@.RegisterSrc="Member.ascx"TagName="Member"TagPrefix="uc1" %>

<%@.RegisterSrc="Testseite2.ascx"TagName="Testseite2"TagPrefix="uc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Untitled Page</title>

<linkhref="StyleSheet.css"rel="stylesheet"type="text/css"/>

</head>

<bodystyle="background-color: #e3efff">

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

<asp:ScriptManagerID="ScriptManager"runat="server"EnablePartialRendering="true">

</asp:ScriptManager>

<div>

<asp:UpdatePanelID="UpdatePanel1"runat="server"UpdateMode="conditional"ChildrenAsTriggers="false">

<ContentTemplate>

<asp:PanelID="Timer"style="z-index:100; position: absolute; top: 584px; left: 27px"runat="server"Height="50px"Width="125px">

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

<ContentTemplate>

<asp:LabelID="TimeLabel"runat="server"style="vertical-align: middle; border-top-style: none; border-right-style: none; border-left-style: none; background-color: white; text-align: center; border-bottom-style: none"BackColor="White"Height="25px"Width="180px"></asp:Label>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="Timer1"EventName="Tick"/>

</Triggers>

</asp:UpdatePanel>

</asp:Panel>

<asp:TimerID="Timer1"runat="server"Interval="900">

</asp:Timer>

<tablestyle="z-index: 119; left: 234px; width: 897px; position: absolute; top: -4px; height: 844px; border-left-color: #a9c0df; border-bottom-color: #a9c0df; border-top-style: ridge; border-top-color: #a9c0df; border-right-style: ridge; border-left-style: ridge; border-right-color: #a9c0df; border-bottom-style: ridge;">

<tr>

<tdstyle="width: 437px; height: 443px"valign="top">

<ajaxToolkit:TabContainerID="TabContainer1"runat="server"height="0px"OnInit="TabContainer1_Init">

</ajaxToolkit:TabContainer>

</td>

</tr>

</table>

<asp:LinkButtonID="LinkButton1"runat="server"Style="z-index: 108; left: 10px;

position: absolute; top: 120px;"CssClass="linkbuttonBlue">neue Auftragsdienstleistung

</asp:LinkButton>

<asp:LinkButtonID="LinkButton2"runat="server"Style="z-index: 109; left: 10px;

position: absolute; top: 143px;"CssClass="linkbuttonBlue">GDL Zuordnung

</asp:LinkButton>

</asp:Panel>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="LinkButton1"EventName="Click"/>

<asp:AsyncPostBackTriggerControlID="LinkButton2"EventName="click"/>

</Triggers>

</asp:UpdatePanel>

</div>

</form>

<scripttype="text/javascript">

function setBodyHeightToContentHeight() {

document.body.style.height = Math.max(document.documentElement.scrollHeight,

document.body.scrollHeight)+"px";

}

setBodyHeightToContentHeight();

window.attachEvent('onresize', setBodyHeightToContentHeight);

</script>

</body>

</html>

please remember, that i'm new to this stuff :)

thanks in advance!


What's wrong with your code? I suppose it's working fine.

Two panels are created, and whenever you click on a linkButton, a corresponding tab panel will be actived.

<%@. Page Language="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TimeLabel.Text = DateTime.Now End Sub Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim myTab As New AjaxControlToolkit.TabPanel TabContainer1.ActiveTabIndex = 0 myTab.Visible = True End Sub Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton2.Click Dim myTab2 As New AjaxControlToolkit.TabPanel TabContainer1.ActiveTabIndex = 1 myTab2.Visible = True End Sub Protected Sub TabContainer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabContainer1.Init If Page.IsPostBack Then TabContainer1.Tabs.Clear() Dim _member As New TextBox() '= LoadControl("~/Member.ascx") Dim myTab As New AjaxControlToolkit.TabPanel myTab.HeaderText = "Tab 1" TabContainer1.Tabs.AddAt(0, myTab) myTab.Controls.Add(_member) End If '//// i know that the following loop doesn't make any sence, it's just the result of my frustration :) If Page.IsPostBack Then Dim _member As New TextBox() ' = LoadControl("~/Testseite2.ascx") Dim myTab2 As New AjaxControlToolkit.TabPanel myTab2.HeaderText = "Tab 2" TabContainer1.Tabs.AddAt(1, myTab2) myTab2.Controls.Add(_member) myTab2.Visible = True End If End Sub </script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><title>Untitled Page</title><link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head><body style="background-color: #e3efff"><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true"></asp:ScriptManager><div><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional" ChildrenAsTriggers="false"><ContentTemplate> <asp:Panel ID="Timer" style="z-index:100; position: absolute; top: 584px; left: 27px" runat="server" Height="50px" Width="125px"> <asp:UpdatePanel ID="UpdatePanelTimer" runat="server"> <ContentTemplate> <asp:Label ID="TimeLabel" runat="server" style="vertical-align: middle; border-top-style: none; border-right-style: none; border-left-style: none; background-color: white; text-align: center; border-bottom-style: none" BackColor="White" Height="25px" Width="180px"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> </asp:UpdatePanel> </asp:Panel><asp:Timer ID="Timer1" runat="server" Interval="900"></asp:Timer> <table style="z-index: 119; left: 234px; width: 897px; position: absolute; top: -4px; height: 844px; border-left-color: #a9c0df; border-bottom-color: #a9c0df; border-top-style: ridge; border-top-color: #a9c0df; border-right-style: ridge; border-left-style: ridge; border-right-color: #a9c0df; border-bottom-style: ridge;"><tr><td style="width: 437px; height: 443px" valign="top"> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" height="0px" OnInit="TabContainer1_Init"></ajaxToolkit:TabContainer> </td></tr></table><asp:LinkButton ID="LinkButton1" runat="server" Style="z-index: 108; left: 10px;position: absolute; top: 120px;" CssClass="linkbuttonBlue">neue Auftragsdienstleistung</asp:LinkButton> <asp:LinkButton ID="LinkButton2" runat="server" Style="z-index: 109; left: 10px;position: absolute; top: 143px;" CssClass="linkbuttonBlue">GDL Zuordnung</asp:LinkButton> </ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click"/><asp:AsyncPostBackTrigger ControlID="LinkButton2" EventName="click"/></Triggers></asp:UpdatePanel></div></form><script type="text/javascript">function setBodyHeightToContentHeight() {document.body.style.height = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)+"px";}setBodyHeightToContentHeight();window.attachEvent('onresize', setBodyHeightToContentHeight);</script> </body></html>

I found a solution, check this out.

it works nearly perfect, but i use a hidden tab to keep my tabcontainer alive. I think this code might help you if you want to implement AJAX Tabs with rich functionality.

PartialClass _Default

Inherits System.Web.UI.Page

Private _memberAs System.Web.UI.Control

Private _TestSeite2As System.Web.UI.Control

Private myTabAs AjaxControlToolkit.TabPanel

Private myTab2As AjaxControlToolkit.TabPanel

Private tabbitabAs AjaxControlToolkit.TabPanelProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

TimeLabel.Text = DateTime.Now

If Session.Item("CreateTab")IsNothingThen

Session.Add("CreateTab",False)

EndIf

EndSub

ProtectedSub LinkButton1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles LinkButton1.Click

If Session.Item("button1clicked")IsNothingThen

Session.Add("button1clicked",True)

Else

Session.Item("button1clicked") =True

EndIf

If Session.Item("UpdateUpdatePanel")IsNothingThen

Session.Add("UpdateUpdatePanel",True)

Else

Session.Item("UpdateUpdatePanel") =True

EndIf

EndSub

ProtectedSub LinkButton2_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles LinkButton2.Click

If Session.Item("button2clicked")IsNothingThen

Session.Add("button2clicked",True)

Else

Session.Item("button2clicked") =True

EndIf

If Session.Item("UpdateUpdatePanel")IsNothingThen

Session.Add("UpdateUpdatePanel",True)

Else

Session.Item("UpdateUpdatePanel") =True

EndIf

EndSub

ProtectedSub TabContainer1_ActiveTabChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles TabContainer1.ActiveTabChanged

EndSub

ProtectedSub TabContainer1_Init(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles TabContainer1.Init

If IsPostBackThen

TabContainer1.Tabs.Clear()

If Session.Item("CreateTab")Then

tabbitab =New AjaxControlToolkit.TabPanel

tabbitab.HeaderText =""

TabContainer1.Tabs.Add(tabbitab)

TabContainer1.ActiveTab = tabbitab

TabContainer1.ActiveTabIndex = TabContainer1.Tabs.Count

EndIf

If Session.Item("button1clicked")Then

_member = LoadControl("~/Member.ascx")

myTab =New AjaxControlToolkit.TabPanel

myTab.HeaderText ="neue Auftragsdienstleistung"

TabContainer1.Tabs.Add(myTab)

myTab.Controls.Add(_member)

TabContainer1.ActiveTab = myTab

TabContainer1.ActiveTabIndex = TabContainer1.Tabs.Count

EndIf

If Session.Item("button2clicked")Then

_member = LoadControl("~/Testseite2.ascx")

myTab2 =New AjaxControlToolkit.TabPanel

myTab2.HeaderText ="GDL Zuordnung"

TabContainer1.Tabs.Add(myTab2)

myTab2.Controls.Add(_member)

TabContainer1.ActiveTab = myTab2

TabContainer1.ActiveTabIndex = TabContainer1.Tabs.Count

EndIf

If Session.Item("UpdateUpdatePanel")Then

UpdatePanel1.Update()

Session.Item("UpdateUpdatePanel") =False

EndIf

EndIf

EndSub

ProtectedSub CloseTabButton_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles CloseTabButton.Click

If IsPostBackThen

Try

If TabContainer1.ActiveTabIs myTabThen

Session.Item("button1clicked") =False

EndIf

If TabContainer1.ActiveTabIs myTab2Then

Session.Item("button2clicked") =False

EndIf

Catch exAs Exception

Session.Item("button1clicked") =False

Session.Item("button2clicked") =False

EndTry

Session.Item("UpdateUpdatePanel") =True

Session.Item("CreateTab") =True

EndIf

EndSub

EndClass

Multiple Timers and Multiple UpdatePanels

I am creating a page with many different server controls that each need to automatically refresh independently. I want the developer to be able to specify the refresh time, so I am exposing that as a property of the control. The problem is, whenever the first timer ticks, all the other timers reset (and the label control in each UpdatePanel updates with the current time) even though they are on different intervals. It acts like all the UpdatePanels are posting back, but I know the tick event is only firing on the first timer (the one with the lowest interval). Any ideas as to what's happening here or what I'm doing wrong?

Here is my (raw, not refactored) code (CreateChildControls method):

If AutoUpdateThen Dim panelAs UpdatePanel =New UpdatePanel()Dim progressAs UpdateProgress =New UpdateProgress() _label =New WebControls.Label()Dim timerAs Timer =New System.Web.UI.Timer() panel.ID =Me.ID +"_UpdatePanel" panel.ChildrenAsTriggers =True panel.UpdateMode = UpdatePanelUpdateMode.Conditional timer.ID = panel.ID +"_RefreshTimer"#If DEBUG Then timer.Interval = IIf(RefreshSeconds <> 0, RefreshSeconds, _refreshMinutes)#Else timer.Interval = _refreshMinutes#End If AddHandler timer.Tick,AddressOf OnTimerTick panel.ContentTemplateContainer.Controls.Add(timer) _label.Text =String.Format("Updated at: {0}", DateTime.Now) panel.ContentTemplateContainer.Controls.Add(control) panel.ContentTemplateContainer.Controls.Add(_label) control = panelEnd If
I've also tried creating the timers outside the UpdatePanels and adding an ASyncPostBack trigger on the Tick event of each timer like so:
 
If AutoUpdateThen Dim panelAs UpdatePanel =New UpdatePanel()Dim progressAs UpdateProgress =New UpdateProgress()Dim timerTriggerAs New AsyncPostBackTrigger() _label =New WebControls.Label()Dim timerAs Timer =New System.Web.UI.Timer() panel.ID =Me.ID +"_UpdatePanel" panel.ChildrenAsTriggers =False panel.UpdateMode = UpdatePanelUpdateMode.Conditional timer.ID = panel.ID +"_RefreshTimer"#If DEBUG Then timer.Interval = IIf(RefreshSeconds <> 0, RefreshSeconds, _refreshMinutes)#Else timer.Interval = _refreshMinutes#End If timerTrigger.ControlID = timer.ID timerTrigger.EventName ="Tick" Controls.Add(timer) panel.Triggers.Add(timerTrigger) _label.Text =String.Format("Updated at: {0}", DateTime.Now) panel.ContentTemplateContainer.Controls.Add(control) panel.ContentTemplateContainer.Controls.Add(_label) control = panelEnd If
Thanks! 

D'oh!


A detail I had failed to mention previously was that these update panels are contained within a surrounding update panel. This panel was set to UpdateMode = Always, which was causing all of the UpdatePanels inside of it to automatically update. I set it to conditional and it seems to work fine now.

-Joe

Multiple UCs on a page

On my page I have two User Controls. One, UC1, has a DropDownList. The other one, UC2, is a list that gets data from a SqlDataSource (datasourcetype=strored procedure), by Repeater.

Whenever the ddl in UC1 is changed, it triggers a function that puts a log record into the database from which UC2 gets the data.

I need the new log record to appear immediately after the selected index of ddl is changed, but it only appears after I refresh the page.

I can't create any triggers for the UpdatePanel of UC1, because the controls are in different UCs.

I tried to use delegates and events, but unsuccessful. My knowledge in that area is limited.

You should be able to use triggers for the update panel even though they are different controls.
Can you post your code?
You can also just refresh the page in code...


Make sure they are both in updatepanels, and set both toUpdateMode="Always". Then, when one updates, the other automatically updates.

Multiple updatepanels vs single updatepanel

Hi,

Anybody got any information regarding the trade off with having either a single updatepanel encapsulating a large number of databound controls (each of which can be independently updated) or multiple updatepanels each surrounding a single databound control?

Any advice or pointers would much appreciated.

Brendy

The answer depends on what gets updated and the dependency that the controls have on each other. Typically, you want to use UpdatePanels to only update fragments of the page that need to be updated, leaving the other areas intact. This technique will also reduce the amount of data that is coming back down from the server to render the page.

So if some controls don't need to be updated regularly, then they belong within their own UpdatePanel (with the UpdateMode set to Conditional).


hi, many thanks for your reply. What I really want to know is, is there a point at which adding more updatepanels to a page starts to have a negative impact on performance? The page that I have has a 10x10 matrix with each cell containing a number of independent datadriven controls. So what's the tradeoff between having one update panel covering the entire matrix or 100 updatepanels one for each cell? Does this slow down the page load?

Cheers

Brendy

Multiple UpdatePanels require their controls to enable ViewState?

I've got 2 update panels on the same page. up1 contains a link button and up2 contains a repeater. I don't need or want the repeater in up2 to be added to Viewstate. However, when up1's link button is clicked, the async call works fine but on return it clears out up2's content. If I set the repeater in up2 to enable viewstate, it then works. If upatepanels are supposed to implement partial page updates, why does up1 wipe out up2's content if up2's content is not in viewstate?

A wild stab in the dark : Is up2.UpdateMode set to "Condtional" ?? if not, then it has a default mode "Always", and gets refreshed on each async postback. If you do not redraw the repeater at that time, or get it from viewstate, then well - you get zilch :)


Ah, yes, that's it. I would have thought the default updatemode would be "Conditional" rather than "Always". Having all the updatepanels update seems counterintuitive to the idea of a partial page update. Anyway, thanks.

Multiple UpdatePanels cause Validation controls to Fail

I'm new to web development in general, and have run into a problem with the UI I'm trying to design. I'm sure that I could lay out the UI in a different fashion to achieve the same ends, but am trying to maintain a simple one-page UI using AJAX for the simple task of entering one word description lookups into a table called TestLookups with only two varchar fields called Category and Description, neither of which allow NULLs. I am trying to use built-in ASP/AJAX controls and functionality as much as possible in order to limit my need to write client-side javascript which I have no experience in.

My page is simple: A DropDownList (and a DataSource for filling it) for selecting the Category of lookups to be entered. A DetailsView whose DefaultMode is Insert for adding new records to the current Category. And a GridView for listing current lookups from the selected Category, along with providing functionality for Editing and Deleting. I have a second DataSource on the page which filters the TestLookups table to the current Category and which serves both the DetailsView and GridView for database access.

As part of this, I simply want to make sure that when users enter a new lookup or edit an existing one, that they not be allowed to leave the description blank; for this I am trying to use RequiredFieldValidators.

The form initially works fine, including appropriate behaviour for the validators. The only exception is that if I edit an item in the GridView, the validator for the field in the DetailsView fires as well, which is undesirable. A perfect place for partial rendering, I think! So I add two update panels, one around the GridView with a trigger to fire when the DropDownList changes, and a second one around the DetailsView to separate its validation from whatever occurs in the GridView.

Now we come to my problems...

First... At this point the DetailsView works fine for data entry, with the exception that the validator only works if it's the first thing that gets fired on the form. For example, I fire up the form and click Insert right off the bat and the validator fires; however, if I fire up the form and do anything else (i.e. change the DropDownList, Delete an item, Edit an item, etc.), then the validator won't fire! Not sure why this is happening...

Second... The Edit functionality won't work! The Edit button gets me into edit mode, I type in my changes, but when I click Update, nothing happens! If I change the Update button's CasesValidation property to False, then it magically starts working, but then of course I've lost my ability to validate the textbox with the RequiredFieldValidator!

If I ignore my desire for required field validation messages, then I'm OK: the DetailsView simply won't do anything when Insert is clicked (fine behaviour) and the GridView will return an error about an invalid NULL value (not a great behaviour, but it's an internal website and my users would be able to figure it out).

I'm hoping someone will tell me what I can do to properly hook these pieces together, or let me know if I'm simply trying to do too much on a single web page (doesn't seem like it though). If there are any workarounds for this out there, I haven't seen anyone talking about them.

I'll include my simple web page below (the final non-working version that I think should work). All anyone needs to do to get this working is create the simple table I described and set themselves up with a Connection.

Thanks for any help anyone can provide!

- Ronn

Source Code:

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false" CodeFile="zzzTest1.aspx.vb" Inherits="zzzTest1" %><!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"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="dsTestLookupCategories" runat="server" ConnectionString="<%$ ConnectionStrings:LabTestingConnectionString%>" SelectCommand="SELECT DISTINCT Category FROM TestLookups ORDER BY Category"></asp:SqlDataSource> <asp:SqlDataSource ID="dsTestLookups" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:LabTestingConnectionString%>" DeleteCommand="DELETE FROM TestLookups WHERE Category = @dotnet.itags.org.Category AND Description = @dotnet.itags.org.Original_Description" InsertCommand="INSERT INTO TestLookups (Category, Description) VALUES (@dotnet.itags.org.Category, @dotnet.itags.org.Description)" OldValuesParameterFormatString="Original_{0}" SelectCommand="SELECT Description FROM TestLookups WHERE (Category = @dotnet.itags.org.Category) ORDER BY Description" UpdateCommand="UPDATE TestLookups SET Description = @dotnet.itags.org.Description WHERE Category = @dotnet.itags.org.Category AND Description = @dotnet.itags.org.Original_Description"> <SelectParameters> <asp:ControlParameter ControlID="ddlCategory" Name="Category" PropertyName="SelectedValue" Type="String" /> </SelectParameters> <InsertParameters> <asp:ControlParameter ControlID="ddlCategory" Name="Category" PropertyName="SelectedValue" Type="String" /> <asp:Parameter Name="Description" Type="String" /> </InsertParameters> <UpdateParameters> <asp:ControlParameter ControlID="ddlCategory" Name="Category" PropertyName="SelectedValue" Type="String" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="Original_Description" Type="String" /> </UpdateParameters> <DeleteParameters> <asp:ControlParameter ControlID="ddlCategory" Name="Category" PropertyName="SelectedValue" Type="String" /> <asp:Parameter Name="Original_Description" Type="String" /> </DeleteParameters> </asp:SqlDataSource> </div> <asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="True"> </asp:ScriptManager> <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="True" DataSourceID="dsTestLookupCategories" DataTextField="Category" DataValueField="Category" Width="175px"> </asp:DropDownList><br /> <br /> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate>   <asp:DetailsView ID="dvTestLookups" runat="server" AutoGenerateRows="False" DataSourceID="dsTestLookups" DefaultMode="Insert"> <Fields> <asp:TemplateField HeaderText="Add New Lookup" ShowHeader="False" SortExpression="Description"> <InsertItemTemplate> <asp:TextBox ID="txtDescriptionInsert" runat="server" Text='<%# Bind("Description")%>' Width="165px"></asp:TextBox><br /> <asp:RequiredFieldValidator ID="rfvDescription" runat="server" ControlToValidate="txtDescriptionInsert" CssClass="validationtext" Display="Dynamic" ErrorMessage="Lookup text is required"></asp:RequiredFieldValidator> </InsertItemTemplate> <ItemStyle BackColor="#9CBACE" /> </asp:TemplateField> <asp:TemplateField ShowHeader="False"> <InsertItemTemplate> <asp:Button ID="btnInsert" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" Width="60px" /> <asp:Button ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" Width="60px" /> </InsertItemTemplate> <ItemStyle BackColor="#9CBACE" HorizontalAlign="Left" /> </asp:TemplateField> </Fields> </asp:DetailsView> </ContentTemplate> </asp:UpdatePanel>   <br /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>  <asp:GridView ID="gvTestLookups" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="dsTestLookups" PageSize="15" Width="550px"> <Columns> <asp:TemplateField HeaderText="Current Lookups" SortExpression="Description"> <EditItemTemplate> <asp:TextBox ID="txtDescription" runat="server" Text='<%# Bind("Description")%>' Width="425px"></asp:TextBox><br /> <asp:RequiredFieldValidator ID="rfvDescription" runat="server" ControlToValidate="txtDescription" CssClass="validationtext" Display="Dynamic" ErrorMessage="Lookup text is required"></asp:RequiredFieldValidator> </EditItemTemplate> <ItemTemplate> <asp:Label ID="lblDescription" runat="server" Text='<%# Bind("Description")%>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField ShowHeader="False"> <EditItemTemplate> <asp:LinkButton ID="btnUpdate" runat="server" CausesValidation="True" CommandName="Update" Text="Update"></asp:LinkButton> <asp:LinkButton ID="btnCancel" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton> </EditItemTemplate> <ItemTemplate> <asp:LinkButton ID="btnEdit" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton> <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton> <ajaxToolkit:ConfirmButtonExtender ID="cbeDelete" runat="server" ConfirmText="You are about to delete the current lookup. Are you sure?" TargetControlID="btnDelete"> </ajaxToolkit:ConfirmButtonExtender> </ItemTemplate> <ItemStyle HorizontalAlign="Right" Width="100px" /> </asp:TemplateField> </Columns> </asp:GridView> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlCategory" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel>  <br />   </form></body></html>

The proper way to isolate validation areas in a page is to use the ValidationGroup property on controls. Set one validationGroup for the controls and validators in the detailsView, and another for the controls and validators in the gridView. You shouldn't need to use UpdatePanels.
This worked great... Thanks!
Validators are not compatable with final version of AJAX
http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx

Multiple UpdatePanels = slow (despite UpdateMode=Conditional)

Hi all,

I'd appreciate help with this as it doesn't seem to make any sense.

I have 2 UpdatePanel controls. I want them to update independently so have set the UpdateMode="Conditional". Each control has a listbox and a button, with the button click populating the listbox.

Now, if the listbox in UpdatePanel2 is empty and I click the button to fill the listbox in UpdatePanel1, this update is very quick (it just returns a handful of rows from the database).

Now, let's say I click the button to fill the listbox in UpdatePanel2, and I happen to add a large number of rows to the listbox (say a couple of thousand). This takes about 10 seconds, which is as expected.

But what I wouldn't expect is for this to dramatically slow down any subsequent updates of the listbox in UpdatePanel1. But that is exactly what happens - any update of the UpdatePanel1 listbox now takes about 10 seconds, even for a few rows. It is as if it is filling the listbox in UpdatePanel2 again.

I thought the whole point of having independent UpdatePanel controls with UpdateMode="Conditional" is to avoid issues like this. Of is there some other reason why this is happening?

Many thanks for assisting a frustrated man.

Richard

What's probably happening is that your ViewState is huge after populating the ListBox. After that, any partial (or full) postback will be transferring that entire ViewState back to the server and the server has to go through instantiating the control from that. That's going to really drag down your performance.

If you can run without ViewState on that control (or even the whole page), do so.

More information:http://encosia.com/2007/07/11/why-aspnet-ajax-updatepanels-are-dangerous/


Hi there,

Thanks for the reply.

If this was the case, I'd expect adding enableviewstate=false to both listboxes to fix the problem, but it doesn't make any difference. Just to verify, I checked the viewstate uning javascript after every async postback and it was only a few kbs throughout at most.

Anyone have any other ideas? This behaviour seems to run completely counter to the idea of independent updatepanel controls.

Cheers,

Richard


In fact, try it yourself:

Click "Update Listbox 1" first - it is instantly filled.

Don't forget the reinstantiation on the server side. Theentire Page is instantiated in every postback, not just the portion relevant to the UpdatePanel that's being refreshed. On the server side, you can basically think of a partial postback as a regular postback that takes the rendered HTML and filters it down to just what's relevant to the UpdatePanels being refreshed. However, that selectivity doesn't come into play until the entire page has finished its life cycle.

So, even though you have independent UpdatePanels, most of that independence is an illusion when thinking about performance.


Right, I see (i think). That makes me wonder: what exactly is the point of the UpdateMode=Conditional then?

It has to be said that UpdatePanels are a touch disappointing, since before ASP.NET AJAX came along we used to use XMLHTTP and javascript manually to do this and did achieve the performance benefits in such situations. I think I'll have to go back to using that.

Thanks again for taking time to explain.


UpdateMode Conditional does reduce the amount of data returned over the wire in a given partial postback. It just turns out to be a negligible gain in a situation like yours, where the bottleneck is somewhere else.

What you can do is use a web service or page methods for something like this, while saving UpdatePanels for something like a GridView where you really need the ViewState. The client side framework that we're given with ASP.NET AJAX works great for leveraging light weight services for a more traditional AJAX approach. That just seems to have been overshadowed by the ease of use of the UpdatePanel.

Multiple UpdateProgress controls not possible?

Hi,

I'm currently learning ASP.NET AJAX. I wanted to play around with the different settings of the DynamicLayout property of the UpdateProgress control. I dragged from the toolbox a scriptmanager, updatepanel and 2 updateprogress controls on the same page.

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="UpdateProgress2.aspx.cs" Inherits="UpdateProgress2" %><!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 runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> </asp:UpdateProgress> <asp:UpdateProgress ID="UpdateProgress2" runat="server"> </asp:UpdateProgress> </form></body></html>

However this results for the second updateprogress control into this error message:Duplicate component name "UpdateProgress2". Component names must be unique and case-insensitive. Am I trying something stupid/not allowed?

Grz, Kris.

Does the error go away if you change the ID of the second UpdateProgress? I notice that your codebehind class happens to be called "UpdateProgress2" as well, and that's not allowed.

I get a different error message for that, though: "member names cannot be the same as their enclosing type," so it's possible that's not the same error you're seeing.


Hi,

thanks! Renaming solved it. Man, I told you I was probably doing something stupidEmbarrassed. I was so focussed on learning the new stuff that I missed that one.

Grz, Kris.

Multiple UpdateProgress Controls

Hi,

Does anyone know if there are plans to allow for multiple UpdateProgress controls in a future release of Atlas? This is an important requirement for most Ajax sites as activity indicators are usually located near the control that triggered the postback.

I have seen a workaround that allows you to do it using a combination of JS and CSS but it would be great if this was automatically available in the framework.

Cheers,

Jason

Do it easily using bindings in the aspx code :

<div id="myProgressUdpate1" >Data Loading</div>
<div id="myProgressUdpate2" >Data Loading</div
<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
<components>
<control id="myProgressUdpate1">
<bindings>
<binding dataContext="_PageRequestManager" dataPath="inPostBack" property="visible" />
</bindings>
</control>
<control id="myProgressUdpate2">
<bindings>
<binding dataContext="_PageRequestManager" dataPath="inPostBack" property="visible" />
</bindings>
</control>
</components>
</page>
</script>

hello.

hum...i think he wanted a solution where only one updatepanel would be show. i think that currently this won't be possible (ie, writting generic code that works in all cases) because you can't get a reference to the updatepanel that is "responsible" for the download.

if the team changes the pagerequestmanager class slightly so that it let us access the posback settings, it would be easy to get that info...


Yes, I do only want one of the updateprogress controls to show depending on the control that triggered the postback. Maybe the UpdateProgress control could be enhanced to allow triggers to be assigned in a similar way to UpdatePanels so that they only show when certain events or conditions occur.
Does anyone from MS have a comment on this one...this is a must-have feature for most AJAX apps?
I would agree, I just tried to accomplish this and without doing a lot of fancy javascript to figure out where the user clicked and show it in the right spot based on what and where things were clicked on I couldn't get it to work. Sure would be nice if UpdateProgress controls could be bound to UpdatePanel controls.

Note this is a supported scenario since ASP.NET AJAX beta 1 with "Value-Add" CTP:
You can have multiple UpdateProgress controls on a page that can run conditionally based on which UpdatePanel callback is occurring.


Thanks...I noticed this in the release notes and it is an excellent enhancement.


Would be even better if we could attach an UpdateProgress to multiple UpdatePanel...!

AssociatedUpdatePanelID="updatePanel1, updatePanel2"


Some people are just never happy ;-)

You're right though...that would be a useful extension to save duplicating the UpdateProgress controls. I can think of at least one case where I could use that although I will probably just locate an UpdateProgress control in "neutral" territory.


Why not make your lives easier and put your UpdateProgress into a UserControl that you can just drag and drop in? Works a LOT easier IMO.

Pluginbaby:

Note this is a supported scenario since ASP.NET AJAX beta 1 with "Value-Add" CTP:
You can have multiple UpdateProgress controls on a page that can run conditionally based on which UpdatePanel callback is occurring.

has anyone actually gotten this to work with either the beta 1 or beta 2 release? when i specify a value for the AssociatedUpdatePanelID property, the UpdateProgress control never appears.

thanks


Yeah...it is working for me in beta 1 although I do have to use the ClientID of the UpdatePanel control rather than just its ID, so if you are using MasterPages, it will look something like "ctl00_ContentPlaceHolder_UpdatePanel". I am therefore setting the AssociatedUpdatePanelID in the Page_Load event using UpdatePanel.ClientID so that I don't have to worry about any changes in the control hierarchy.

I had a number of problems with beta 2 and had to rollback to beta 1 so not sure if the above is the same for beta 2.

Cheers,

Jason


I made a very simple test to try out UpdateProgress in Beta 2.

There'a a Master Page with a ScriptManager on it.

A Content Page that looks like this

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>   <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /> </Triggers> </asp:UpdatePanel> <br /> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DynamicLayout="False"> <ProgressTemplate>loading...</ProgressTemplate> </asp:UpdateProgress> <br />   <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate>  <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button" /> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2" DynamicLayout="False"> <ProgressTemplate>loading...</ProgressTemplate> </asp:UpdateProgress>
Code is:
 
protected static int i = 0;protected void Page_Load(object sender, EventArgs e) { }protected void Button1_Click(object sender, EventArgs e) { Label1.Text = DateTime.Now.ToLongTimeString(); System.Threading.Thread.CurrentThread.Join(1000); }protected void Button2_Click(object sender, EventArgs e) { i++; Label2.Text = i.ToString(); System.Threading.Thread.CurrentThread.Join(1000); }

It's just two buttons and two labels. The first one displays the date, the second one increases a counter. Both have an UpdatePanel and UpdateProgress. The first UpdatePanel has a trigger event, which is the Button1's click. The second UpdatePanel has both the Button2 and Label2 inside it.

The first UpdateProgress does NOT work. The second one does. I didn't have to use ClientID or Unique ID, even though I'm using Master Pages. The problem, as far as I can see, is when the UpdatePanel has a trigger.


That still does not work for me - using beta 2. I have a page (that uses a masterpage), with two web user controls, each with their own updatepanel and updateprogress controls. when i try to specify the AssociatedUpdatePanelID in either user control in the Page_Load i get the following error:

No UpdatePanel found for AssociatedUpdatePanelID 'ctl00_ContentPlaceHolder1_Weather1_WeatherUpdatePanel'

I also tried to just create a simple page (w/o using a masterpage) with 2 updatepanels, 2 updateprogress controls and 2 buttons. when i specify the AssociatedUpdatePanelID in Page_Load on this page, there is no error message, but neither UpdateProgress control is never displayed either. If I don't specify the AssociatedUpdatePanelID, then both UpdateProgress controls appear.

If anyone else has any thoughts, I'd appreciate it. I can also post code, if desired.

Thanks

Multiple ValidatorCalloutExtender controls

I have a table with multiple fields and validation controls. When I put 2 validatorcalloutextenders on the page only 1 will work on postback. For example, I have a validatorcalloutextender for to requiredfieldvalidators on my page:
1) txtWeight
2) txtProduct

Validation is set to True for my button control on the page. When clicked, only the validatorcalloutextender for txtWeight is displayed. I enter in a weight and tab out of the field and resubmit the page. The 2nd validatorcalloutextender doesn't fire.

I'm guessing that the this has something to do with the updatepanel...

Can you post your code for us?


Hi,

This is very likely be caused by that Validator isn't compatible with UpdatePanel. Please refer to this:

http://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx

The following ASP.NET controls are not compatible with partial-page updates, and are therefore not supported inside an UpdatePanel control:

TreeView and Menu controls.

Web Parts controls. For more information, see ASP.NET Web Parts Controls.

FileUpload controls when they are used to upload files as part of an asynchronous postback.

GridView and DetailsView controls when their EnableSortingAndPagingCallbacks property is set to true. The default is false.

Login, PasswordRecovery, ChangePassword, and CreateUserWizard controls whose contents have not been converted to editable templates.

The Substitution control.

Validation controls, which includes the BaseCompareValidator, BaseValidator, CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator, RequiredFieldValidator, and ValidationSummary control.

And here is a workaround may help: http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx

Hope this helps.


Hello,

I had already implemented the workaround (noted above in Matt's blog) before posting. I don't think the issue is with the original validation controls but rather with the callout extender. The issue is that you have to tab into the 2nd control that is being validated. If you have several controls on your form and the first control and the last control are the controls that need to be validated the last control on your page will not kick off the extender. I've attached a simple example. With this example, when you click the button the 1st extender will kick off. Enter in some text for the first textbox but DO NOT tab to the next textbox. Instead, click on the button. You will see that the extender doesn't execute for he 2nd textbox.

<%@. Page Language="VB" AutoEventWireup="false" CodeFile="testAJAX.aspx.vb"Inherits="testAJAX" %><%@. RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!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 runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>  </div> <asp:Button ID="Button1" runat="server" Text="Button" />        <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="t1"></asp:RequiredFieldValidator> <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="RequiredFieldValidator1"> </ajaxToolkit:ValidatorCalloutExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="t2"></asp:RequiredFieldValidator> <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" TargetControlID="RequiredFieldValidator2"> </ajaxToolkit:ValidatorCalloutExtender> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

Only onbe message is shown in specific time.You should focus on other fields to see the errors.

Hmm...that kind of defeats the whole purpose of using the fancy extenders. If I have to write code to send focus to extenders based on what controls have already been validated...well, that's just down right silly!


Well, dotcarlisle's last post is marked as the Answer, but I don't see anything indicating his problem is solved! He just provided an example to reproduce the problem.

I, too am having trouble working with two calloutextenders within an updatepanel. I put dotcarlisle's sample code in a page, ran it, and followed his instructions, and the same exact thing happens in my solution. Why's that post marked as the Answer, though?

That post was done back in July, so I'm wondering if there's been a fix (yes, I have the latest AJAX relase: 10920) or a workaround provided somewhere.

Anyone have any ideas?


Hey capella07. I agree! I'm not sure why that was marked as the answer - if anything it was a mini *** session but a far cry from an answer. I also noticed that the sequence in the messages looks messed up. Why would I reply to someone's reply, or rather advertisement, for Opera?

My guess is that users get deleted and with the user goes that user's posts. In my book that seems to be a bug. THey should keep truncated user's posts around for data consistency...

Anyway, good call, Capella.


Hey, dotcarlisle. Thanks for the nod.

As a quick update, I just tried the "fix" at Matt Gibbs' blog (http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx), and that didn't work.

Frankly I'm very suprised this particular issue with the Toolkit hasn't gotten more attention. Though probably not terribly frequent, seems to me it'd be somewhat common that multiple callout extenders would be needed on a page.

Monday, March 26, 2012

MultiView control, View control and nested UpdatePanels

I have an application that is using a MultiView control to simulate "tabs". Within that MultiView control, I have a number of View controls with nested UpdatePanels and they work just fine. However, whenever I try to encase the MultiView control inside an UpdatePanel, paging between the View controls works fine with no postbacks, but none of the UpdatePanels in any of the View controls works after that.

Has anyone ever run into this or provide any suggestions? Code samples available if necessary...

Thanks!

hello.

yes, seeing a small sample would help. btw, i must say that i still don't like the idea of nesting updatepanels.

MultiView, User Controls, PopupControlExtender

I have a webpage containing a MultiView. I put a user control in every view of the MultiView. From each user control, I use the ModalPopupExtender to open another user control, which contains fields for entering dates. I then use the calendar control and PopupControlExtender to select date.

It works fine when only one user control in the modal popup window has the calendar control and the PopupControlExtender. If more than one user controls opened with the modal popup extender have the calendar control and the PopupControlExtender, none of them works. In the latter case, I can still popup the calendar, but it doesn't allow me to select date, and it doesn't close. The calendar would dispear if I click outside the calendar area. But then I can't close the window containing the user control opened with the modal popup extender.

Anyone has similiar experience?

Please try your scenario with the recently available61020 release of the Toolkit (and ASP.NET AJAX Beta 1). If the problem persists, then please reply with acomplete, self-contained sample page that demonstrates the problem. Thank you!

Saturday, March 24, 2012

Need help

I'm using asp.net ajax controls in my application. ( i do't now about the version but downloaded last year OCT)

and builded a application using this. And installed the latest version(Currently available in download).

In previous version assemblies are named as "microsoft.web.extensions"

and current version assemblies are named as "system.web.extensions"

So i can use my previous application after updation of my ASP AJAX extension.

any bodies please help me to solve this problem.

Thanx in advance.

well, you cant use latest AJAX dll for your old project.

only thing you can do is modified your old project with latest ajax dll and web.config


Thanking you for your response.

I did a mistake. Actually it's not working...

but, i think that installing the assembly "Micrososft.web.extensions" to GAC is enough to run the application.......

any idea????

Wednesday, March 21, 2012

need help to start, Scriptmanager

Hello,

First time I try to include an atlas control.

I get an error "Extender controls require a ScriptManager to be present on the page."

Attempting to create cascading drop down lists, so here is the aspx code: (took cars sample and edited)

<atlasToolkit:CascadingDropDownID="CascadingDropDown1"

runat="server">

<atlasToolkit:CascadingDropDownProperties

TargetControlID="projectDDL"

Category="Project"

PromptText="Select a manufacturer"

ServiceMethod="populateProjectDDL"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="wellDDL"

ParentControlID="projectDDL"

PromptText="Select a well"

ServiceMethod="populateWellDDL"

Category="Well"/>

<atlasToolkit:CascadingDropDownProperties

TargetControlID="sectionDDL"

ParentControlID="wellDDL"

PromptText="Select a section"

ServiceMethod="populateSectionDDL"

Category="Section"/>

</atlasToolkit:CascadingDropDown>

<asp:DropDownListID="projectDDL"runat="server"CssClass="label"Style="z-index: 105;

left: 281px; position: absolute; top: 92px"AutoPostBack="True"TabIndex="1">

</asp:DropDownList>

<asp:DropDownListID="wellDDL"runat="server"CssClass="label"Style="z-index: 106;

left: 281px; position: absolute; top: 154px"AutoPostBack="True"TabIndex="2">

</asp:DropDownList>

<asp:DropDownListID="sectionDDL"runat="server"CssClass="label"Style="z-index: 107;

left: 281px; position: absolute; top: 214px"TabIndex="3">

</asp:DropDownList>

In the code behind I have three populate subs that fetch data from sql db:

PrivateSub populateProjectDDL()

PrivateSub populateWellDDL()

PrivateSub populateSectionDDL()

Also had some*_SelectedIndexChanged subs, that used to do the job atlas is now going to do I suppose.

Back to the problem: scriptmanager?! What is that - where do I put it? Please help me get my first alas control going... Would be very nice..

A ScriptManager tag looks like:

<atlas:ScriptManager ID="ScriptManager1" runat="server" />

You may want toread more on Atlas itself to understand what one is and what it can do.


Yeah, sry, kinda rushed that question in,

didn't think this post would even be approved, delete, close, whatever... hehe

Thx for reply, sry about this post.