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

Wednesday, March 28, 2012

UpdateProgress progress property: UpdatePanelID. Will this ever be available ?

Hi, I was just wondering if will ATLAS ever have this property for UpdateProgress, so this way we could have several UpdateProgress controls, each one showing only with their associated UpdatePanel is being updated. I think it's something "essential" and I'm a bit worried about how this feature is still not available. Maybe is not possible for some reason ??

Eric

hello.

well, i guess this isn't necessary in the current release because you can only have one partial postback at a time. currently, i'd be happy if i was able to get a reference to the updatepanel that started the partial postback (and this is possible because the pagerequestmanager mantains a reference to it internally - it simply doesn't have a property that let's us get that info!


I have a situation where it is necessary. I have two UpdatePanels and would like to show the UpdateProgress on top of my UpdatePanel. If I could associate the UpdateProgress with the UpdatePanel then this would be easy because when the UpdatePanel is sending data back and forth to the server it would show only the appropriate UpdateProgress control.
I'm surprised too why this has not been added yet. It's more intuitive to the user when the loading indicator only appears in the specific section of the page that is updating.
lookherefor a javascript/css solution. have not tried it out yet though.
the noverber CTP has an AssociatedUpdatePanelID property on the UpdateProcess control. This allows you to tell the updateprogress to display when the desired update panel is posting back.

UpdateProgress stops working after first firing

Running locally, my apps work fine. When I deploy to a remote server, my UpdateProgress controls stop working or work intermittently. The server is IIS6 on 2003. Sharepoint is running on the server but I have added scriptresource.axd and webresource.axd to excluded paths. Latest version of Ajax is installed. Seperate app pool. The hard thing is it works locally!! What else can i look at?? Here is the source:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="UPTest.aspx.cs" Inherits="UPTest" %><!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"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0" runat="server"> <ProgressTemplate> <img alt="progress" src="Images/indicator_green.gif" /> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

-----------

using System;using System.Web.UI.WebControls;public partialclass UPTest : System.Web.UI.Page{protected void Button1_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(5000); Label1.Text = DateTime.Now.ToLongTimeString(); }}

I'm getting this issue as well.

Any one know of a fix / explanation?


i am experiencing this as well.

anyone??


NOTE: fixed this issue by adding the "DisplayAfter" property w/any value

<

asp:UpdateProgressID="progressPanel"DisplayAfter="1"runat="server">
Unfortunately this did not work for me...has anyone else found another solution to this by any chance?

I ended up just using the javascript events in the end to show and hide a div.

think they're called onbeginrequest and onendrequest or something similar

HTH


Ok, call me dense, but I am not seeing this event anywhere in the scriptmanager, updatepanel, or updateprogress control...could you point me in the right direction please?

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerEndRequestEvent.aspx


Martin,

Thank you for this....I thought you had it solved for me, but it seems I have hit another snag. It seems that after the first call the div I am using is removed from the DOM rather than just being set to hidden. I can no longer find it in the DOM inspector thus my Javascript call can not find the element the next time the panel comes around...what is strange is that it is being removed before the EndRequestHandler is called...so there must be an event between BeginRequestHandler and EndRequestHandler that seems to be removing the element from the DOM. Did you run into this problem or am I just lucky ;-)

Thanks in advance,

Josh


Is your div inside the Update Panel itself?

If so it may be getting replaced by the contents of the Ajax call.


Unfortunately I wish it was as trivial as that, but it is not inside my update panel. I am quite lost on what could be doing this...

Josh


Ok I have worked on this all day today and have made noprogress...here is my code, please someone tell me what I am doingwrong...
1<%@. Page Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs"2 Inherits="Default2" Title="Untitled Page" %>34<%@. Register src="http://pics.10026.com/?src=Modules/MainNavigation.ascx" TagName="MainNavigation" TagPrefix="uc1" %>5<%@. Register src="http://pics.10026.com/?src=Modules/Products/ProductSummaryDisplay.ascx" TagName="ProductSummaryDisplay"6 TagPrefix="uc2" %>7<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">8 <asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" EnablePartialRendering="true" runat="server">9 </asp:ScriptManager>1011 <script type="text/javascript">12 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);13 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);14 function BeginRequestHandler(sender, args)15 {16 var elem = args.get_postBackElement();17 ActivateAlertDiv('visible', 'AlertDiv');18 }19 function EndRequestHandler(sender, args)20 {21 ActivateAlertDiv('hidden', 'AlertDiv');22 }23 function ActivateAlertDiv(visstring, elem)24 {25 var adiv = $get(elem);26 adiv.style.visibility = visstring;27 }28 </script>2930 <div id='leftcontent'>31 <uc1:MainNavigation ID="MainNavigation1" runat="server" />32 </div>33 <div id='centercontent'>34 <div class='sectionheader'>35 <a href="<%=Page.ResolveUrl("~/default.aspx")%>">Home</a> >><asp:Label ID="lblBreadCrumb"36 runat="server"></asp:Label></div>37 <asp:UpdatePanel ID="UPanel1" ChildrenAsTriggers="true" runat="server" UpdateMode="conditional">38 <ContentTemplate>39 <asp:Panel ID="Panel1" runat="server" Height="50px" Width="700px" HorizontalAlign="Center">40 <div style="float: left;">41 <asp:LinkButton ID="btnDecreasePage1" runat="server" OnClick="btnDecreasePage1_Click"><< Previous ></div>42 <div style="float: left;">43 Page44 <asp:Label ID="lblCurrPage1" runat="server" Text="1"></asp:Label>45 of46 <asp:Label ID="lblTotalPages1" runat="server"></asp:Label></div>47 <div style="float: left; clear: right;">48 <asp:LinkButton ID="btnIncreasePage1" runat="server" OnClick="btnIncreasePage1_Click"> Next >></asp:LinkButton>49 </asp:Panel>50 <div style="float: right">51 Num Products Per Page:<asp:TextBox ID="txtProductsPerPage" runat="server" Text="6"52 AutoPostBack="true" MaxLength='4' Width="3em" OnTextChanged="txtProductsPerPage_TextChanged"></asp:TextBox> </div>53 <br />54 <asp:DataList runat="server" ID="productList" RepeatColumns="3" RepeatDirection="Horizontal"55 EnableViewState="False">56 <ItemTemplate>57 <uc2:ProductSummaryDisplay ID="ProductSummaryDisplay1" runat="server" ProductGUID='<%# Eval("ProductGUID")%>'58 ProductName='<%# Eval("ProductName")%>' ImageFile='<%# Eval("imageFile")%>'59 ProductID='<%# Eval("productID")%>' OurPrice='<%#Eval("OurPrice")%>' RetailPrice='<%#Eval("RetailPrice")%>'60 ShippingEstimate='<%#Eval("ShippingEstimate")%>' Rating='<%#Eval("Rating")%>'61 SKU='<%#Eval("SKU")%>' />62 </ItemTemplate>63 </asp:DataList>64 <asp:Panel ID="Panel2" runat="server" Height="50px" Width="250px" HorizontalAlign="Center">65 <div style="clear: left; float: left;">66 <asp:LinkButton ID="btnDecreasePage2" runat="server" OnClick="btnDecreasePage1_Click"><< Previous ></div>67 <div style="float: left;">68 Page69 <asp:Label ID="lblCurrPage2" runat="server" Text="1"></asp:Label>70 of71 <asp:Label ID="lblTotalPages2" runat="server"></asp:Label></div>72 <div style="float: left">73 <asp:LinkButton ID="btnIncreasePage2" runat="server" OnClick="btnIncreasePage1_Click"> Next >></asp:LinkButton>74 </asp:Panel>75 </ContentTemplate>76 </asp:UpdatePanel>77 <div id="AlertDiv" class="loadingbox" style="visibility:hidden;">78 <img src="images/spinner.gif" align="absmiddle" />  Processing...79 </div>80 </div>81 <div id='rightcontent'>82 </div>8384</asp:Content>85

Thank you in advance,

Josh


Your manual show/hide should work. The fact it isn't could be for the same reason the UpdateProgress wasn't working. Examine your document for possible missing closing tags, etc. Look at the rendered html instead of the aspx. Inside the update panel, the "<<" and ">>" in your next/previous buttons looks suspect. Encode them as >> and << (they almost look like html tags otherwise). If you have any <script src="http://pics.10026.com/?src="> tags make sure they are not of the self-closing variety. For example <script src="http://pics.10026.com/?src=.." type="text/javascript"></script>, not <script src="http://pics.10026.com/?src=.." type="text/javascript" />.

Is $get(elem) returning an element or null?


Well you sir hit the nail on the head, I had some open tags. It wasn't showing up on source view as an issue strangely enough. I just went down one by one.

Also thank you for pointing out my glaring mistake with the >> and <<, that is not normal practice for me in my defense....

Thanks again!

UpdateProgress with DropDownList Controls (or others)

I have a UpdateProgress control that works with the submit button; how do I get it to work with a dropdown list that gets populated from a web service? Thanks.

Dan

I am not sure, if i had understood your problem correctly. An UpdateProgress control is attached to an update panel. So it doesnt matter if the post back is caused by a button or a dropdownlist. Make sure you have the dropdownlist in the updatepanel for which the updateprogress is attached.

Thanks

Monday, March 26, 2012

Updating atlas and toolkit

If you already have atlas installed and created a new application via the atlas template in visual studio and are using the atlas "controls" how do you do upgrades when new releases of atlas or the controls come out? Will the new setup files update your system (templates,controls and apps) or is there something else that you will have to do?

You'll just need to copy over the Atlas assemblies in your \bin directory, and potentially update the Atlas settings in the web.config file.

Hope this helps,

Scott

Updating Controls in a ModalPopup Possible?

Hello,

I am trying to use a modalpopup as a login prompt.

I've been able to put a couple textboxes in the modal, take input from those textboxes, and log a user in and redirect them or do whatever I would like. The problem I am having is when a user types in a wrong password, I need to display a "Invalid Password" lable to the user, hopefully in the modalpopup window.

The way I am validating a user is an XML call back to a third party server with custom software.

I havent tried to write a providor yet to use the .NET login things.

So my question boils down to, Can controls in an update panel be updated upon an OK click.

Thanks!

-Shane

Yes, it's possible. Though currently it will require a "work around". It will also require the reworked ModalPopupExtender that I know you are familiar with. There's a link in my sig.

First you need to do is create "fake buttons" for the OkControl and CancelControl property of the modalpopupextender. These buttons need to present at all times during your login routine, so place them at the very end of your popup panel. Also set them with a css style of display:none; The button controls visible property must be set to true.
Sean,

I will give this a try this tommarow when I'm back at the office.
I want to let you know that the Re-Worked ModalPopup is really good. It has solved quite a few problems.

Seeing as you seem so good with this stuff, thought I would ask a more diffucult question dealing with the modal popup.
I am using a modal in a gridview to display product information. To get the product information, I am using a web serivce (amazon webservice to be exact). On the click of the linkbutton on the gridview, I have the webservice kicked in to get the information, and sometimes it takes anywhere from 2 - 4 seconds to get the information about the product. I am using the onrowbound event to add attribs to the linkbutton for a window.timeout($object('modal')._show), 2000) or something like that to open the modal about 2 seconds after the linkbutton is clicked.
this works when the webservice returns the information before 2 seconds. If the request takes more than 2 seconds, the modal opens up, the request finishes, and the modal closes by itself. I have this modal setup with an update panel inside the modal, but currently, the update panel has the ok, cancel buttons included in it. I'll give it a try tommarow with those buttons outside of the update panel.
Anyways, seeing as you know more about all of this than me, I thought I would ask you :P
thanks for all your help
-shane

Hey Sean,

I got the login modal to update labels within it self doing just like you described.

However, I've ran into some minor problems that I thought I would see if you maybe have already solved.

1. How would I make a textbox get focus when the modal pops up?

2. How can I make the button the default button so when the user hits enter, it hits that button, and not a button on the page it self. Right now, if I hit enter, it fires an event tied to a button on the main page. if the main page does not have a button, then hitting enter works fine.

Any suggestions?

thanks for all the help, once again!

-Shane


Hi i live that problem. When i press Enter it opens the other Panel :S and it makes me crazy. By the way this is Header.ascx

<ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender1"runat="server"BackgroundCssClass="modalBackground"

TargetControlID="lbLogin"PopupControlID="pnlLoginVisible"PopupDragHandleControlID="pnlLogin"

CancelControlID="lbClose">

</ajaxToolkit:ModalPopupExtender>

<asp:PanelID="pnlLoginVisible"runat="server"DefaultButton="LinkButton1"Style="display: none;">

<asp:PanelID="pnlLogin"runat="server"CssClass="modalPopup">

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

<ContentTemplate>

<divid="loginbackground">

<divid="logintop">

<divid="logintoptext1">

<asp:LabelID="Label6"runat="server"meta:resourceKey="lblLoginText"Text="Giri? Yap"></asp:Label>

</div>

<divid="logintopclose1">

<asp:LinkButtonID="lbClose"CssClass="logintopcloselink"runat="server"CausesValidation="false"

Text="Kapat"meta:resourceKey="lblClose"></asp:LinkButton>

</div>

</div>

<divid="loginbottom">

<divstyle="width: 290px; height: 40px; padding-left: 5px;">

<divclass="logintext2">

<asp:LabelID="Label7"runat="server"meta:resourceKey="lblUsernameText"Text="Kullan?c? Ad?:"></asp:Label>

</div>

<divclass="logininput2">

<asp:TextBoxID="txtLUserName"CssClass="logininputtext2"runat="server"></asp:TextBox>

<asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"ControlToValidate="txtLUserName"

ErrorMessage="*"ValidationGroup="Login"SetFocusOnError="True"></asp:RequiredFieldValidator>

</div>

</div>

<divstyle="width: 290px; height: 40px; padding-left: 5px;">

<divclass="logintext2">

<asp:LabelID="Label8"runat="server"meta:resourceKey="lblPassword"Text="Parola:"></asp:Label>

</div>

<divclass="logininput2">

<asp:TextBoxID="txtLPass"runat="server"CssClass="logininputtext2"TextMode="Password"></asp:TextBox>

<asp:RequiredFieldValidatorID="RequiredFieldValidator2"ValidationGroup="Login"

runat="server"ControlToValidate="txtLPass"ErrorMessage="*"SetFocusOnError="True"></asp:RequiredFieldValidator>

</div>

</div>

<divid="loginbottom2">

<asp:LabelID="Label1"meta:resourceKey="lbLoginFailed"Visible="False"runat="server"Text="Yanl?? Kullan?c? Bilgisi"></asp:Label>

<!-- hata mesaj?n?n cikacagi yer -->

</div>

<divstyle="float: left; width: 130px; padding-left: 20px; padding-top: 6px;">

<asp:HyperLinkID="HyperLink1"CssClass="loginbottomlink2"NavigateUrl="~/forgotpassword.aspx"

meta:resourceKey="lblForgotPass"Text="Parolam? Unuttum"runat="server"></asp:HyperLink></div>

<divid="loginbottom3">

<asp:LinkButtonID="LinkButton1"OnClick="btnLogin_Click"CssClass="logintext3"ValidationGroup="Login"

runat="server"Text="Giri?"></asp:LinkButton>

</div>

</div>

</div>

</ContentTemplate>

</asp:UpdatePanel>

</asp:Panel>

</asp:Panel>

<ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender2"runat="server"BackgroundCssClass="modalBackground"

TargetControlID="lbRegister"PopupControlID="pnlRegisterVisible"PopupDragHandleControlID="PnlRegister"

CancelControlID="lbRClose">

</ajaxToolkit:ModalPopupExtender>

<asp:PanelID="pnlRegisterVisible"DefaultButton="btnRegister"runat="server"Style="display: none;">

<asp:PanelID="PnlRegister"runat="server"CssClass="modalPopup2">

<divid="registertop">

<divid="registertoptext1">

<asp:LabelID="lblSignup"runat="server"meta:resourceKey="lblSignup"Text="üye Ol"></asp:Label>

</div>

<divid="registertopclose1">

<asp:LinkButtonID="lbRClose"CssClass="logintopcloselink1"CausesValidation="false"

runat="server"Text="Kapat"></asp:LinkButton>

</div>

</div>

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

<ContentTemplate>

<divid="registerbackground">

<divid="registerbottom">

<divclass="registertext1">

<asp:LabelID="Label2"Text="E-Posta:"meta:resourceKey="lblMail"runat="server"></asp:Label>

</div>

<divclass="registerinputdiv1">

<asp:TextBoxID="txtEposta"runat="server"CssClass="registerinput1"></asp:TextBox>

<asp:RequiredFieldValidatorValidationGroup="Register"ID="RequiredFieldValidator3"

runat="server"ErrorMessage="*"ControlToValidate="txtEposta"/>

</div>

<divclass="registertext1">

<asp:LabelID="Label3"meta:resourceKey="lblUserName"runat="server"Text="Kullan?c? Ad?n?z:"></asp:Label>

</div>

<divclass="registerinputdiv1">

<asp:TextBoxID="txtRUsername"runat="server"CssClass="registerinput1"></asp:TextBox>

<asp:RequiredFieldValidatorID="RequiredFieldValidator4"runat="server"ValidationGroup="Register"

ControlToValidate="txtRUsername"ErrorMessage="*"></asp:RequiredFieldValidator>

</div>

<divclass="registertext1">

<asp:LabelID="Label4"meta:resourceKey="lblPass"runat="server"Text="Parola"></asp:Label>

</div>

<divclass="registerinputdiv1">

<asp:TextBoxID="txtSifre"runat="server"CssClass="registerinput1"TextMode="Password"></asp:TextBox>

<asp:RequiredFieldValidatorID="RequiredFieldValidator5"ValidationGroup="Register"

runat="server"ErrorMessage="*"ControlToValidate="txtSifre"/>

</div>

<divclass="registertext1">

<asp:LabelID="Label5"meta:resourceKey="lblPassRep"runat="server"Text="Parola Tekrar?:"></asp:Label>

</div>

<divclass="registerinputdiv1">

<asp:TextBoxID="txtSifreTekrar"runat="server"CssClass="registerinput1"TextMode="Password"></asp:TextBox>

<asp:RequiredFieldValidatorValidationGroup="Register"ID="RequiredFieldValidator6"

runat="server"ErrorMessage="*"ControlToValidate="txtSifreTekrar"/>

</div>

<div>

<divid="result"runat="server">

<asp:RegularExpressionValidatorID="RegularExpressionValidator1"runat="server"ControlToValidate="txtEposta"meta:resourceKey="RegUnValidEmail"ErrorMessage="Ge?ersiz e-mail adresi"SetFocusOnError="True"

ValidationGroup="Register"ValidationExpression="\w+([-+.']\w+)*@.\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator><br/>

<asp:CompareValidatorID="CompareValidator1"runat="server"ControlToCompare="txtSifre"

ControlToValidate="txtSifreTekrar"meta:resourceKey="RegUnMatchPass"ErrorMessage="?ifreler Uyu?muyor"

SetFocusOnError="True"></asp:CompareValidator><br/>

<asp:CustomValidatorID="CustomValidator2"ValidationGroup="Register"runat="server"

ClientValidationFunction="sifrevekullanici"meta:resourceKey="RegMinPasswordChr"

ControlToValidate="txtSifre"ErrorMessage="Parolan?z minimum 5 karakter olabilir."

SetFocusOnError="True"></asp:CustomValidator><br/>

<asp:CustomValidatorID="CustomValidator1"ValidationGroup="Register"runat="server"

ClientValidationFunction="sifrevekullanici"meta:resourceKey="RegMinUserChr"

ControlToValidate="txtRUsername"ErrorMessage="Kullan?c? ad?n?z minimum 5 karakter olabilir."

SetFocusOnError="True"></asp:CustomValidator><br/>

<asp:LabelID="lblRegisterError"CssClass="failed"runat="server"Text=""></asp:Label><br/>

<asp:LabelID="lbRegisterSucced"runat="server"CssClass="succes"meta:resourceKey="lbRegisterSucced"

Visible="false"Text="Kullan?c? kayd?n?z ba?ar?yla al?nm??t?r."></asp:Label>

<br/>

<asp:LabelID="lblRegisterFailed"runat="server"CssClass="failed"meta:resourceKey="lbRegisterFailed"Visible="false"Text="Hata olu?tu. Lütfen daha sonra tekrar deneyiniz."></asp:Label>

</div>

</div>

</div>

</div>

</ContentTemplate>

<Triggers>

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

</Triggers>

</asp:UpdatePanel>

<divclass="registerbutton1">

<asp:LinkButtonID="btnRegister"runat="server"OnClick="btnRegister_Click"CssClass="registerbuttonlink"

Text="üye Ol"ValidationGroup="Register"meta:resourceKey="btnRegister"></asp:LinkButton>

</div>

</asp:Panel>

</asp:Panel>

<tableclass="style1"align="center"cellpadding="0"cellspacing="0">

<tr>

<tdclass="style2">

</td>

<tdclass="style3">

<divid="head">

</div>

<divid="headover">

<divid="logo">

<imgsrc="images/logo.png"width="187"height="103"class="png"></div>

<divid="girismenu">

<divid="uyeol">

<asp:ImageButtonID="lbRegister"meta:resourceKey="ibRegister"runat="server"ImageUrl="~/images/uyeol.png"Width="55"Height="45"CssClass="png"CausesValidation="False"/>

</div>

<divid="cizgi">

</div>

<divid="girisyap">

<asp:ImageButtonID="lbLogin"runat="server"meta:resourceKey="ibLogin"ImageUrl="~/images/girisyap.png"

Width="60"Height="40"CssClass="png"CausesValidation="False"/>

<asp:ImageButtonID="lbLogOut"runat="server"CssClass="png"Height="40px"ImageUrl="~/images/cikis.png"meta:resourceKey="ibLogOut"

Width="60px"OnClick="lbLogOut_Click"CausesValidation="False"Visible="False"/></div>

</div>

Updating Controls outside of UpdatePanel on Partial Page Postback

Hi all - I apologize if this has been asked elsewhere. I searched and couldn't find it...

Anyway, I am having an issue where I am doing a partial page postback from a textbox located inside of an UpdatePanel. Based on what the user enters there I need to update a DropDownList located outside of the combo box using the SelectedValue property. When I do it using a normal ASP.NET PostBack without an Ajax UpdatePanel it works fine but when it is called inside of the Handler for the control inside an UpdatePanel it does not work. Is there some setting I need to change to get it to be able to update that control not inside of the UpdatePanel? Thanks for any help.

Don

Hi,

only the controls inside the refreshed UpdatePanel(s) get updated after a partial postback. If you want to update an external control, you should do it using JavaScript on the client side.


HI Garbin, thanks for the post. Actually what I did (and perhaps you were eluding to it) is I placed my DropDownList in its own UpdatePanel with the Update Mode as conditional. Then when my other control fires off and the value of the DropDownList needs to be set, I just set its value and call the Update() method of the UpdatePanel.

Works like a charm.

Thanks!

Don

Updating multiple controls

I have an asp.net web site. I have many text boxes, drop downs and check boxes that need to be populated based on user input. I have a main text box for them to put in an ID number and a button to run my code. The problem is that the text boxes and check boxes are all over the form so I can't group them in one update panel.

Also, some of the check boxes, drop downs and text boxes can change the data in other controls based on user input. This causes so many post backs under normal conditions. If I put everything in an update panel, isn't that still going to cause just as many post backs?

Putting the whole page in one UpdatePanel will cause pretty much the same amount of data to be sent back to the server (the whole viewstate is always sent) and by the sounds of it pretty much the same amount of data comin back. It would reduce network traffic a bit and get rid of the screen flicker though.

You really need to put just the bits that update in multiple UpdatePanels, they will all get updated when one does. However, I'd go one step further and set all of them to UpdateMode="Conditional" so you can only update the panels you need to when you need to.


Thank you. I looked into that a bit further and also watched a video on multiple update panels. I will try this, conditional updates and add triggers to the update panels. Thanks again.

updating only portion of a User control

Hi,

I Have an application Where I am dyanmically Loading User controls in a Main Page Content area(in an Update Panel)

And Each user control has its own update panel. for Example I have a List box and a text box and the Text box is in an update panel

And when the user select an item in the list box i need to update the text box upadate panel.

But the problem is since all these controls are in a user control and the user control loads in a place holder in an update panel in my main page.

To get the events of the user control child controls i need to load it again while asynchrounous post back

ie When user selects a menu item i am loading my user control into a place holder in an update panel in the main page.

and when the user clicks on the list box in my user control to get the selected index changed event i need to load the user control again

in my cs code. to the place holder . but i am only updating the text box in my user control. and so i placed that in an update panel.

but the problem is since my user control is inside an update panel in my main page the whole user control get refreshed.

I put the update mode of my main page update panel as conditional and when the user double clicks on the list box i load the user control in the palce holder so that i will get the events but i didn't update the main update panel. I did call only update for the update panel for the text box(which is in my user control)

but still my whole user controls get refeshed . Is there any solution for this

Thanks and regards

jereesh

Where the control that make posteback is located , is it inside your main update panel ?

if yes so you have to set "ChildrenAsTriggers" of your main update panel to false.

please let us know about your aspx code


HiI have a Main page where there is an update panel( where a place holder exists )which is made as conditionalAnd I have user controls(ascx) which are dynamically loaded into this update panel-into the place holder-(when user clicks on different menu items in main page. And inside each user Control there is an update panel where all child controls are placedand I may have update panels for individual controls in user controlfor example in one of my user control I have a list box and a text box and when i double click on the list box i need to change the text box value so i kept the text box inside an update Panel. but the problem is when i click on the list box in a user control if i need to get the event(selected indexchnaged) for that user control i need to load it again to the place holder in the cs file(Main.aspx.cs), ie if may user control name is search.ascxi am usong LoadControl method and adding it to the placeholder in my main page(this should happen each time when any postback occurs because of an event for a child control in the user control- then only i will get its events).I kept all update panel's update mode as conditional. and I will call only update for the update panelwhre my text box exists ( ie the update panel inside my user control). I only call Update for my main update panelonly when I need to load another user control ie when the user selects another menu item from the main page. mainupdatepanel -- Upadated only when new user control is to be loade usercontrolupdatepanel - Updated conditionally usercontrolchildcontrolUpdatepanel-- updates conditionallyThanks and Regards

Hi,

You have to set "ChildrenAsTriggers" of your main update panel to false.

Best Regards,

Saturday, March 24, 2012

Upgrade to Beta 1 = New Rating control error

I installed the latest framework and toolkit.

My project was working fine with a wizard control that contained rating controls. I've taken the rating controls out of the wizard template and put them in their own update panel and still receive the error. It's a very strange behavior. If I make a new page and do everything, the rating control works fine. I'm using the latest control and did all the changes required to use the new Beta. After the install, I keep receiving this error when loading the page:

System.InvalidOperationException was unhandled by user code
Message="The TargetControlID of '_RatingExtender' is not valid. The value cannot be null or empty."
Source="Microsoft.Web.Extensions"
StackTrace:
at Microsoft.Web.UI.ExtenderControl.RegisterWithScriptManager()
at Microsoft.Web.UI.ExtenderControl.OnInit(EventArgs e)
at AjaxControlToolkit.ExtenderControlBase.OnInit(EventArgs e) in C:\Program Files\Microsoft ASP.NET\AjaxControlToolkit\AjaxControlToolkit\ExtenderBase\ExtenderControlBase.cs:line 338
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at System.Web.UI.ControlCollection.Add(Control child)
at Microsoft.Web.UI.UpdatePanel.SingleChildControlCollection.AddSingleChild(Control child)
at Microsoft.Web.UI.UpdatePanel.AddContentTemplateContainer()
at Microsoft.Web.UI.UpdatePanel.CreateContents(Boolean recreate)
at Microsoft.Web.UI.UpdatePanel.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Thanks

Anyone ? Can you please take a look? I believe others are experiencing something similar with the mentioned TargetControlID.

Thanks


When the project breaks, it breaks at the bold:

/// <summary>
/// On Init we load target properties values and process databinding handlers.
/// </summary>
/// <param name="e"></param>
protected override void OnInit(EventArgs e)
{
if (EnableClientState)
{
CreateClientStateField();
}
// EnsureProfileScriptService(ScriptManager.GetCurrent(Page), true);
Page.PreLoad += new EventHandler(Page_PreLoad);
base.OnInit(e);
}


Please reply with acomplete, self-contained sample page that demonstrates the problem. Thank you!

In my case the problem occures when I specify the rating control in the skin file.

Skinfile:

<

ajaxToolkit:Ratingrunat="server"StarCssClass="ratingStar"WaitingStarCssClass="savedRatingStar"FilledStarCssClass="filledRatingStar"EmptyStarCssClass="emptyRatingStar"/>
Good to know! Do you have a complete, self-contained sample we can play with?

Just add the following 2 lines in the Default.skin file of the Ajax Control Toolkit SampleWebSite:

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>
<ajaxToolkit:Ratingrunat="server"StarCssClass="ratingStar"WaitingStarCssClass="savedRatingStar"FilledStarCssClass="filledRatingStar"EmptyStarCssClass="emptyRatingStar"/>

Then try to open the Rating sample of the SampleWebSite.


The SampleWebSite doesn't have a Default.skin file - might there be something else going on here that's causing issues?

Wednesday, March 21, 2012

Usage of CDATA or comments around Javascript -> future problems?

Hi, it appears (from other posts) I need to use CDATA sections aroundJavascript emitted from my controls to prevent them breakingAtlas. However, I also note the point made herehttp://www.netmechanic.com/news/vol6/javascript_no12.htm
about the fact that newer browsers may legitimately ignore Javascript functions inside comments.

Any thoughts? Shouldn't Atlas be modified to work without scripts being commented?

Thanks
Jim

Yes Jim I fully agree with you.I have same problem.

If I keep the javascript triggers not work and if I remove then it works.I dont know how to solve this issue.

use __doPostBack with Ajax

Hi,

I have a page that is updated frequentlly (it presents stock data) .

I use ajax contrl tool kit controls .

right now there is an ajax Timer control on the update panel, which calls the Update Panel's Update method if needed.

I get my data via wcf client proxy , my question is, is there a way to receive events from wcf on server side?

then hold an updated datatable of stock data?

Thanks

Take a look at this example ofusing __doPostBack to trigger an UpdatePanel refresh.

Additionally, you might be interested in this: http://encosia.com/2007/07/25/display-data-updates-in-real-time-with-ajax/


hello.

well, not sure on what you're asking here...if you want to have a partial refresh caused by your timer, then you should set it up as an asyncpostbacktrigger. if you only want to have a refresh when you receive new data on the server side, then you should do something like this:

1. build a web service that polls the server side to see if there is new data (you can, for instance, have a session variable that will let you know the date of the last update of the data on the server side)

2. when you receive the response you should see if you need to refresh the panel

3. if you do, you should use gt1329a's (sorry man, but i don't know your name :) ) excellent advise and force a refresh of your panel


Hi,

Thanks for your reply, I already implemented what you suggested (sorry for my confused question..)

but im looking for a more efficient solution, to reduce calls to wcf servic.(if its possible)

actually what I meant to ask is , is there a way to hold on server side a DataTable or any other data structure that

will be updated through wcf callbacks (or other type of callbacks from a DLL) , so when a client requests the page i don't need to call the wcf service.

I can bind my data presentation controls to the updated data structure , and server side will handle the updates regardless of client calls .

I think it will be more efficient then calling wcf services from the aspx pages for every request to that page and on each timer tick.

but where can I hold and update that data structure (via wcf callbacks) ?

i want it to be alive with no dependecy on page that are beeing requested.

what do you suggest?

Thanks,

tal


hello.

what you need is some sort of "asp.net singleton". adding a static field to the httpapplication object will be enough for that. here is an extremly interesting article about singletons:

http://www.yoda.arachsys.com/csharp/singleton.html

btw, do notice that this has some problems, specially when you think about web farms, etc...

Use Ajax controls within web control

Is there any example that show how to write a custom web control (one that doesn't have aspx) and use Ajax controls ?

I have a user control consisting of a panel the modalpopupextender. I have a copy of the aspx and .cs file in all the sites. I want to turn it into a control so I can re-use it. How can I achive it?

Hi Thanhhuynh,

Basically, you can drag it into your customer control without doing any other special settings. Ajax Control Toolkits work depend on ScriptManager or ToolkitScriptManager. Please make sure that the ScriptManager should be located before the extender and inside a page there should be only one ScriptManager. To create customer control , here are two samples(sample1 andsample2).

I hope this help.

Best regards,

Jonathan


Thanks for answering.

Basically there are two type of controls I can create: web control and web user control. The former contains only code. There's no UI designer support where you can drag and drop different controls into it. You can to override the RenderXX() methods to create the look. The web user control has the UI part and the code behind and you can design right on the screen. But web user can only be used within the same web site. You have to copy the aspx and code-hind files to another web site source tree in order to re-use it.

So my question was let's say I create a new control, without VS UI designer how can I use the AJAX extender ?

Thanks


I believe the answer you are looking for is in this blog post by David Ebbo:http://blogs.msdn.com/davidebb/archive/2005/10/30/487160.aspx

Good luck,

Hanan Schwartzberg
---------------
http://www.lionsden.co.il