Showing posts with label working. Show all posts
Showing posts with label working. Show all posts

Wednesday, March 28, 2012

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 stops working

Hello everybody,

my problem: I have a gridview in an update panel, and the gridviews header contains some DropDownLists for filtering data. Also the Gridview is enabled for Sorting

and Paging. All works fine. But to inform the user that the action he started is on the way, i included a UpdateProgress with a gif animation. So when the user starts filtering

or sorting the gif animation is shown and animated. But after a short time, it stands still. A second or two later, the GridView is bound completely and the gif disappears.

So something seems to block the UpdateProgress. What am i doing wrong ? the gif animation is on top of the gridview.

any hint is aprreciated, thanks a lot !

This happens when the browser is rendering the response... Haven't found really anything to do about it :(

-Damien

Updating a ContentPlaceHolder with Ajax

I am working on a project which uses a MasterPage with one ContentPlaceHolder. I have a custom menu control on the MasterPage. When an item in the menu is clicked I need the ContentPlaceHolder to be updated with the requested content. I know this can easily be done using an iframe, but I'd rather stay away from iframes and like to do this with Ajax.

Basically my question is if this is possible at all. I've been trying a couple of things but without success and I think it may have to do by the way a MasterPage works.
If not possible, is there some kind of workaround for this? (without residing to iframes)

Thanks!

Hi Rino,

I tried also the same thing as you. I had a menu on my master page and an ContentPlaceHolder in my update panel. That didn't work. I think it isn't possible what you want to do.

Regards,


Unfortunately, no. It's just not how master pages and AJAX work. I just finished a post on the topic here:http://odetocode.com/Blogs/scott/archive/2007/01/03/9682.aspx


Thanks guys for clearing this up!
Would be great as a new .Net feature though :)


You can do it right now, actually, it's not that big of a deal. You don't really need a contentplaceholder for it, just a Div that you can hook into w/ javascript (giving it an ID, for example). You have your menu item click handler fire a javascript function that calls a web service and then have the onrequest complete handler fill the div with the stuff it gets back.

paul.vencill:

You don't really need a contentplaceholder for it, just a Div that you can hook into w/ javascript (giving it an ID, for example). You have your menu item click handler fire a javascript function that calls a web service and then have the onrequest complete handler fill the div with the stuff it gets back.

Paul: Yes, but this is an entirely different approach.


Understood. I was trying to offer something that might work for his application. is there a good reason you can think of to limit his app to using contentplaceholders?

No, my goal was just to point out that updating content place holders with content from a different page isn't how the technologies work together. It seems to be a common question these days, so I'm trying to clear that up.

The right way to achieve this would be to use a solution like you proposed!


ah, ok, cool. :D

It is very easy.

See my last post about "Handling events...".

Updating a DataList with UpdatePanel

I've been trying to update my DataList with UpdatePanel but it's not working.

What I have is a text field for a user to enter comments and a save button, along with a DataList control all in an UpdatePanel.

Data is being saved on the table when the save button is clicked but the DataList is not updated unless I refresh the browser. What am I doing wrong?

Here is my ASP code:

 <asp:UpdatePanel ID="UpdatePanel3" runat="server"> <ContentTemplate> <asp:Panel ID="PanelCommentBody" runat="server" CssClass="collapsePanel" Width="451px"><br /> <asp:TextBox ID="txtComments" runat="server" Height="45px" TextMode="MultiLine" Width="412px" ValidationGroup="cmnts" ></asp:TextBox><br /> <asp:Label ID="lblComment" runat="server" Text="" Font-Size="Small"></asp:Label> <asp:RequiredFieldValidator ID="RFVComments" runat="server" ErrorMessage="Please enter comment." ValidationGroup="cmnts" ControlToValidate="txtComments" Font-Size="Small" Width="154px"></asp:RequiredFieldValidator> <asp:Button ID="bttnPostComment" runat="server" Text="Post Comment" OnClick="bttnPostComment_Click" ValidationGroup="cmnts" Width="122px" /> <asp:Button ID="bttnDiscard" runat="server" Text="Discard" OnClick="bttnDiscard_Click" CausesValidation="false" /> </asp:Panel> <cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender2" runat="server" CollapseControlID="closeComment" ExpandControlID="closeComment" TargetControlID="PanelCommentBody" Collapsed="true" SuppressPostBack="true"> </cc1:CollapsiblePanelExtender> <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" Width="307px" Font-Size="Small"> <ItemTemplate> <strong>From: <a href="../Default.aspx?urnm=<%# Eval("UserName")%>"><asp:Label ID="FromLabel" runat="server" Font-Size="Small" Text='<%# Eval("UserName")%>'></asp:Label></a></strong> | Date Posted: <asp:Label ID="DateAddedLabel" runat="server" Text='<%# Eval("DateAdded", "{0:MMM dd, yy}")%>'></asp:Label><br /> <asp:Label ID="CommentLabel" runat="server" Text='<%# Eval("Comment")%>'></asp:Label><br /> <br /> </ItemTemplate> </asp:DataList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyDB%>" SelectCommand="SELECT [UserName], [Comment], [DateAdded] FROM [Comments] WHERE ([CL_Id] = @dotnet.itags.org.CL_Id) ORDER BY [DateAdded] DESC"> <SelectParameters> <asp:Parameter DefaultValue="1" Name="CL_Id" Type="String" /> </SelectParameters> </asp:SqlDataSource> </ContentTemplate> </asp:UpdatePanel>

Here is my Code Behind for the save button:

protected void bttnPostComment_Click(object sender, EventArgs e)
{
string flname = Request.QueryString["filename"];
flname = flname.Substring(0, flname.Length - 4);

if (User.Identity.IsAuthenticated)
{
MembershipUser myObject = Membership.GetUser();
string usrid = myObject.ProviderUserKey.ToString();
string usrname = User.Identity.Name;
string cmmnt1 = txtComments.Text;
string connStr = ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
SqlConnection cnn = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("INSERT INTO Comments (CL_Id, UserId, UserName, Comment) VALUES ('" + flname + "', '" + usrid + "', '" + usrname + "', '" + cmmnt1 +"')", cnn);
cnn.Open();
cmd.ExecuteNonQuery();
cnn.Close();
}
else
{
lblComment.Text = "You need to login to make comments";
}
}

----------

Thanks in advance,

Louis

1. Make UpdatePanel UpdateMode="Conditional"

2. after cnn.close(); write UpdatePanel3.Update()


Thanks siva sakki, I tried your suggestion but it still doesn't work.

What else can I try?

Louis


Updating a DataList with UpdatePanel

On Page_Load event, register DataList control

protected void Page_Load()
{
ScriptManager1.RegisterAsyncPostBackControl(DataList1);

DataList1.DataSource = this.SqlDataSource1;
DataList1.DataBind();
}


Thanks chetan, your suggestion might work. My problem is that I have the ScriptManger1 in the master page.

How can I reference this the way you have specified above?

Thank you,

Louis


I have tried the following to reference the the ScriptManger from content panel code behind:

ScriptManager.GetCurrent(this.Page).RegisterAsyncPostBackControl(DataList1);

is this the correct way of doing it? If it is my UpdatePanel still not updating. I have also removed this two lines:

//DataList1.DataSource = this.SqlDataSource1;
//DataList1.DataBind();

It is giving me this error:

Both DataSource and DataSourceID are defined on 'DataList1'. Remove one definition.

Do I need this two lines for it to work?

I am pulling my hair on this one.

Please help. Thanks again.

Louis


If you go back to the original code you submitted and add DataList1.DataBind() at the end of the button routine, you would probably achieve the results you want.

There is nothing to cause the DataList to rebind after the button event.

If you simply delete the UpdatePanel from the page, your code would not work either. As a rule, if doesn't work without Ajax, it won't work with it. The DataBinding event for the DataList has to run on the postback.


wrayx1 that did the trick.

Thank you soooo much!!!

Louis


Just do withDataList1.DataBind();

Let me know if this helps you


Okay, I have a similar question about updating using DataList. Will someone give me a hand on this. Here's what I have.

1<asp:ScriptManager ID="ScriptManager1" runat="server">2 </asp:ScriptManager>3<%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">4 <ContentTemplate>--%>5 <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True">6 <asp:ListItem Value="True">Approved</asp:ListItem>7 <asp:ListItem Value="False" Selected="True">Not Approved</asp:ListItem>8 </asp:RadioButtonList>9 <asp:SqlDataSource ID="sqlApproval" runat="server" ConnectionString="<%$ ConnectionStrings:myConnStr%>"10 SelectCommand="SELECT [frstName], [lstName], [dvlID], [mdlName], [mdnName], [degree1], [degree2], [year1], [year2], [sp_frstName], [sp_lstName], [sp_year1], [sp_year2], [sp_mdlName], [sp_mdnName], [sp_degree1], [sp_degree2], [approval] FROM [dvlStory] WHERE ([approval] = @.approval)"11 DeleteCommand="DELETE FROM [dvlStory] WHERE [dvlID] = @.dvlID"12 InsertCommand="INSERT INTO [dvlStory] ([frstName], [lstName], [mdlName], [mdnName], [degree1], [degree2], [year1], [year2], [sp_frstName], [sp_lstName], [sp_year1], [sp_year2], [sp_mdlName], [sp_mdnName], [sp_degree1], [sp_degree2], [approval]) VALUES (@.frstName, @.lstName, @.mdlName, @.mdnName, @.degree1, @.degree2, @.year1, @.year2, @.sp_frstName, @.sp_lstName, @.sp_year1, @.sp_year2, @.sp_mdlName, @.sp_mdnName, @.sp_degree1, @.sp_degree2, @.approval)"13 UpdateCommand="UPDATE [dvlStory] SET [frstName] = @.frstName, [lstName] = @.lstName, [mdlName] = @.mdlName, [mdnName] = @.mdnName, [degree1] = @.degree1, [degree2] = @.degree2, [year1] = @.year1, [year2] = @.year2, [sp_frstName] = @.sp_frstName, [sp_lstName] = @.sp_lstName, [sp_year1] = @.sp_year1, [sp_year2] = @.sp_year2, [sp_mdlName] = @.sp_mdlName, [sp_mdnName] = @.sp_mdnName, [sp_degree1] = @.sp_degree1, [sp_degree2] = @.sp_degree2, [approval] = @.approval WHERE [dvlID] = @.dvlID">14 <SelectParameters>15 <asp:ControlParameter ControlID="RadioButtonList1" Name="approval" PropertyName="SelectedValue"16 Type="Boolean" />17 </SelectParameters>18 <DeleteParameters>19 <asp:Parameter Name="dvlID" Type="Int32" />20 </DeleteParameters>21 <UpdateParameters>22 <asp:Parameter Name="frstName" Type="String" />23 <asp:Parameter Name="lstName" Type="String" />24 <asp:Parameter Name="mdlName" Type="String" />25 <asp:Parameter Name="mdnName" Type="String" />26 <asp:Parameter Name="degree1" Type="String" />27 <asp:Parameter Name="degree2" Type="String" />28 <asp:Parameter Name="year1" Type="Int32" />29 <asp:Parameter Name="year2" Type="Int32" />30 <asp:Parameter Name="sp_frstName" Type="String" />31 <asp:Parameter Name="sp_lstName" Type="String" />32 <asp:Parameter Name="sp_year1" Type="Int32" />33 <asp:Parameter Name="sp_year2" Type="Int32" />34 <asp:Parameter Name="sp_mdlName" Type="String" />35 <asp:Parameter Name="sp_mdnName" Type="String" />36 <asp:Parameter Name="sp_degree1" Type="String" />37 <asp:Parameter Name="sp_degree2" Type="String" />38 <asp:Parameter Name="approval" Type="Boolean" />39 <asp:Parameter Name="dvlID" Type="Int32" />40 </UpdateParameters>41 <InsertParameters>42 <asp:Parameter Name="frstName" Type="String" />43 <asp:Parameter Name="lstName" Type="String" />44 <asp:Parameter Name="mdlName" Type="String" />45 <asp:Parameter Name="mdnName" Type="String" />46 <asp:Parameter Name="degree1" Type="String" />47 <asp:Parameter Name="degree2" Type="String" />48 <asp:Parameter Name="year1" Type="Int32" />49 <asp:Parameter Name="year2" Type="Int32" />50 <asp:Parameter Name="sp_frstName" Type="String" />51 <asp:Parameter Name="sp_lstName" Type="String" />52 <asp:Parameter Name="sp_year1" Type="Int32" />53 <asp:Parameter Name="sp_year2" Type="Int32" />54 <asp:Parameter Name="sp_mdlName" Type="String" />55 <asp:Parameter Name="sp_mdnName" Type="String" />56 <asp:Parameter Name="sp_degree1" Type="String" />57 <asp:Parameter Name="sp_degree2" Type="String" />58 <asp:Parameter Name="approval" Type="Boolean" />59 </InsertParameters>60 </asp:SqlDataSource>61 <br />62 <asp:DataList ID="dltApproval" runat="server" BackColor="White" BorderColor="#999999"63 BorderStyle="None" BorderWidth="1px" CellPadding="3"64 GridLines="Vertical" RepeatColumns="3" RepeatDirection="Horizontal" Width="700px" DataSourceID="sqlApproval">65 <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />66 <SelectedItemStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />67 <ItemTemplate>68 <table border="0" cellpadding="2" cellspacing="0">69 <tr>70 <td>71 <asp:Label ID="frstNameLabel" runat="server" Text='<%# loadStory()%>'></asp:Label>72 </td>73 <td>74 <asp:CheckBox ID="chbApproval" runat="server" Checked='<%# Bind("approval")%>' />75 </td>76 </tr>77 </table>78 </ItemTemplate>79 <AlternatingItemStyle BackColor="Gainsboro" />80 <ItemStyle BackColor="#EEEEEE" ForeColor="Black" />81 <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />82 </asp:DataList>83<%-- </ContentTemplate>84 </asp:UpdatePanel>--%>85 <table border="0" cellpadding="5" cellspacing="0" width="700">86 <tr>87 <td style="width: 100px; text-align: center">88 <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Update" /></td>89 <td style="width: 100px; text-align: center">90 <asp:Button ID="btnFinish" runat="server" OnClick="btnFinish_Click" Text="Finish" /></td>91 </tr>92 <>  

And here's the code behind:

1protected void Page_Load(object sender, EventArgs e)2 {34 }5protected string loadStory()6 {7//load the data in here and display to the lable control8return strInfoHolder.ToString() ;9 }10protected void btnUpdate_Click(object sender, EventArgs e)11 {12 sqlApproval.Update();13 dltApproval.DataBind();14 }15protected void btnFinish_Click(object sender, EventArgs e)16 {17 Response.Redirect("~/Admin/");18 }

The problem I have is that it's not updating. At the moment, I disabled the AJAX UpdatePanel to figure out the udpate first. All I wanted is to update the Approval checkbox to the sqlDataSource control. Noticed I used Bind instead of Eval for the checkbox control that way I was hoping that once I called the sqlApproval.Update() method, the approval checkbox will automatically update the database field. However, that is not so. Any help is appreciated.

Updating a FreeTextBox within an UpdatePanel

Hello everybody,

I'm working on a translation interface for a multilingual intranet. This leads me to use Rich TextBoxes such as FreeTextBox.

It is well known that there are issues about it when used with ajax.net, but I tried...


My issue:

I've got a page with three imbricated updatePanels. UpdatePanel1 contains both of the other update panels.

When updating these controls, I want a freeTextBox to get a text to translate.

But, not only does the FreeTextBox refuses to get the text, it also generates javascript errors that prevent me from openning an ajax modal popup.

I've tried to replace Freetextboxes by simple asp textboxes and this works fine... excepted as regards the fact that i can see all the html, and cannot put my text in form...

Coulds give me a hint to solve this? Do you know another rich text box with which i would have this issue?

Thanx a lot.

DART did the same thing, TinyMCE too... The only richTextBox I have tested which works is CuteEditor.

From what I've read, the issue comes from the focus on the textbox.

So no soultion for the moment.


Hi, I think I had the opposite problem to you. I could get the text by using .Text property but I couldn't set the text byassigning a new value to .Text.

I had to use the following code as a workaround : -

Private Sub SetEnoteText(ByVal strNotesAs String)Dim strScriptAs String =String.Format( _"$get('ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText').value = '{0}';", _ strNotes.Replace(vbLf, "").Replace(vbCr, "")) strScript += "ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText_Initialize(ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText_editor, $get('ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText'));" ScriptManager1.RegisterStartupScript(Me,Me.GetType(),"SETNOTE", strScript,True)End Sub
'ctl00_maincontentarea_HeaderTabs_eNoteTab_eNoteText' Being the ID of the FreeTextBox.
 
 

Monday, March 26, 2012

Updating Nested Repeaters

I'm working on a page with nested repeaters. The child repeater is for comments that can be added by users. My problem is updating the child repeater when a comment is added. I have something like:

<UpdatePanel id="parentUpdatePanel">

<repeater id="parent">

<item stuff>

<UpdatePanel id="commentUpdatePanel">

<repeater id="comments">

<comment stuff>

</repeater>

<a href="http://links.10026.com/?link=javascript:AddComment(itemID)">Add Comment</a>

</UpdatePanel>

</repeater>

</UpdatePanel>

The AddComment function brings up a div-type-dialog to enter the comment. It's doing an AJAX postback to add the comment, but I can't find a way to get back to my comment repeater to update it with the added comment. The comments are also in an asp:panel, so that I can hide them until the user clicks on a "View Comments" link under each item. I could possibly just collapse the panel, and when they re-expand it, it will reload just fine, but that won't look very nice.

I assume that when the parent repeater is databound you are also binding the child repeater for each item in the parent repeater, am I correct? If this is the case if you were to call databind again for your parent repeater shouldn't this rebind the child comment repeater within?


I've found a way around my issue. I tacked on a hidden field in my parent repeater with the item's ID value so I can do a FindControl on the hidden field and match the item ID up. Then, if I know which item I'm dealing with in the parent I can also do a FindControl on my child repeater and update it. Less elegant than I'd like, but it works quite well.

Updating Slideshow PlayInterval with Slider

I am updating the Slideshow PlayInterval with a SliderControl. I have the SlideShow in an UpdatePanel and all is working fine EXCEPT the entire slide show starts over when I change the slider. I would like ONLY the PlayInterval property to update and the SlideShow to continue from the image it is displaying.

Does anybody know if this is possible?? If so, any suggestions....

Thanks,
Jim

Hi Jim,

You may save current image index in a hiddenfield before the PlayInterval is updated, and restore it after that.

For instance:

before:

var index = $find("behaviorIDofSliderShow")._currentIndex;

after:

$find("behaviorIDofSliderShow")._currentIndex = index;


Raymond,

I am thinking this is C# code. I am using VB and the $find isn't working. I am using something like:

Index = SlideShowExtender1.BehaviorID.IndexOf() but can't figure out what goes in the brackets because the $find doesn't work...

Wonder if you can help me out in a VB sort of way?

Thanks,

Jim


Jim,

It's javascript, which runs on the client. It should be embedded in the html source directly. Below is an example of using javascript:

<%@. 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"
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides(string contextKey)
{
return new AjaxControlToolkit.Slide[] {
new AjaxControlToolkit.Slide("SliderShowImages/Blue hills.jpg", "Blue Hills", "Go Blue"),
new AjaxControlToolkit.Slide("SliderShowImages/Sunset.jpg", "Sunset", "Setting sun"),
new AjaxControlToolkit.Slide("SliderShowImages/Winter.jpg", "Winter", "Wintery..."),
new AjaxControlToolkit.Slide("SliderShowImages/Water lilies.jpg", "Water lillies", "Lillies in the water"),
new AjaxControlToolkit.Slide("SliderShowImages/VerticalPicture.jpg", "Sedona", "Portrait style picture")};
}

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides2(string contextKey)
{
return new AjaxControlToolkit.Slide[] {
new AjaxControlToolkit.Slide("http://forums.asp.net/Themes/FAN/style/i/logo.png", "Blue Hills", "Go Blue"),
new AjaxControlToolkit.Slide("http://forums.asp.net/themes/fan/style/i/avatar_null_59x59.jpg", "Sunset", "Setting sun")};
}

protected void Page_Load(object sender, EventArgs e)
{
this.slideshowextend1.ContextKey = Request.QueryString["qs"];
string script = "window.open(imgUrl);";
Image1.Attributes.Add("onclick", script);
}
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body text="#1000">
<form id="form1" runat="server">
<div
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager
<asp:Image ID="Image1" runat="server"
Height="300" Style="border: 1px solid black;width:auto"
ImageUrl="/SlideShowImages/Blue hills.jpg" AlternateText="Blue Hills image" />
<asp:Label runat="server" ID="imageDescription" CssClass="slideDescription"></asp:Label><br /><br />
<asp:Button runat="Server" ID="prevButton" Text="Prev" />
<asp:Button runat="Server" ID="playButton" Text="Play" />
<asp:Button runat="Server" ID="nextButton" Text="Next" />
<ajaxToolkit:SlideShowExtender ID="slideshowextend1" runat="server"
TargetControlID="Image1" BehaviorID="ss1" SlideShowServicePath="slidershowextender.aspx" SlideShowServiceMethod="GetSlides"
AutoPlay="true" ImageTitleLabelID="imageTitle" ImageDescriptionLabelID="imageDescription" NextButtonID="nextButton"
PlayButtonText="Play"
StopButtonText="Stop" PreviousButtonID="prevButton"
PlayButtonID="playButton" Loop="true" />
<input id="Button1" type="button" value="Change Interval" onclick="return Button1_onclick()" />
<asp:Button ID="Button2" runat="server" Text="Stop" OnClientClick="stop();return false;"/>
<input id="Text1" type="text" value="1000" /></div>
</form
<script type="text/javascript">var slider1;
function pageLoad(){
slider1 = $find("ss1");
slider1.add_slideChanging(onSlideChanged);
slider1._currentIndex = 1;
}
var imgUrl = "http://www.microsoft.com";

function onSlideChanged(sender, args){
// var index = sender.get_imageTitleLabelID();
imgUrl = slider1._currentImageElement.src;
// alert(args.get_slideIndex());
}

function stop()
{
var s=$find('ss1');
if(s._inPlayMode)
s._play();
}

function Button1_onclick() {
alert(slider1.get_playInterval());
var interval = $get("Text1").value;
slider1.set_playInterval(interval);
alert(slider1.get_playInterval());
}

</script>

</body>
</html>

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?

Uploading files

I am using ajax 1.0, when i am uploading files, it does not working properly, it is not uploading any images. I heared that file upload will not work in ajax, is it true? help appreciated

Hi sreejithpkrishnan,

I don't know if you want to uploadfiles in combination wioth an update panel if so check the summary below:

Controls that are not compatible with updatepanel controls

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

TreeView andMenu controls.


Hi,

the FileUpload, and several other controls, don't play nicely together with the UpdatePanel control. You can however use inside it but must set it to be a PostBackTrigger for the UpdatePanel. Read more about ithere andhere. The last link provides a sample for the FileUpload control that works together with the UpdatePanel control.

Grz, Kris.


hello.

In the past, I've written an extender which lets you upload files without performing a postback. it was written for the beta 2 or rc version (really can't recall it), but you should be able to update it to the current release without having much problems.

http://msmvps.com/blogs/luisabreu/archive/2006/12/14/uploading-files-without-a-full-postback.aspx

Wednesday, March 21, 2012

Urgent Help Required

Hi All,

I am new to Atlas Technology. Just I started an application with Atlas but it is not working. I created web site using Asp.net Web site Template instead of using Atlas Web Site template. I refer Atlas dll in my application, then also it is not working, it shows an "Unknown Error" message. Can we use Atlas if the application opened in asp.net web site template. Or we must need to open it in Atlas web site template.

Can any one tell me what are all the requirements needed for Atlas based application, that is in Client and developing machine requirements. Whether we need JVM for running Atlas based application.

I just create a sample web application using Asp.net web site template. The page consist of two text box and two button. One button is "Add" and other button is "Back". If I press Add button it call server side btnadd_Click using Atlas. But it is not working. I am pasting my code here please tell me solution for this.

<atlas:ScriptManager id="scptMgr" runat="server" EnablePartialRendering="true" />

<asp:TextBox ID="txtAstClassName" runat="server"></asp:TextBox>
<asp:TextBox ID="txtAstClassPrefix" runat="server"></asp:TextBox>

<atlas:UpdatePanel Mode="Conditional" ID="atlasUpdate" runat="server">
<ContentTemplate></ContentTemplate>

<Triggers>
<atlas:ControlEventTrigger ControlID="btnAdd" EventName="Click" />
</Triggers>
</atlas:UpdatePanel>
<asp:Button ID="btnAdd" runat="server" Text="Add"

OnClientClick="AddUpdateAssetClass()" OnClick="btnAdd_Click" />
<asp:Button ID="btnBack" runat="server" Text="Back" />

I set web config like this

<

controls>
<

add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas" />
<

add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas" />
</

controls>

In this I call server side Add Click event in Atlas Trigger. But It shows error.

It is very urgent Please help me, Any sample program which is created using Asp.Net web template and Atlas pls send to me.

maximasshel@dotnet.itags.org.yahoo.com

maximasshel@dotnet.itags.org.hotmail.com

Regards,

Maximasshel

Hi,

if you are working with the ASP.NET WebSite template, be sure to reference the Atlas dll but also to update the web.config (the changes you made to your web.config are not enough).

The easiest way to update the web.config is copying it (or the relevant sections) from the Atlas WebSite template.

Hi

I refer dll in my application and I get this config information from other project which is created in Atlas Web Site template.

I just include add button event in atlas trigger, that shows error.

regards,

maximasshel

urgent: Modal popup Extender is not closing after validation fires

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

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

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

here is my close button looks like:

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

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

what is going on here?

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

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


i fixed myself, i was passing the wrong id.

thanks.

URL rewriting not working with ATLAS ( AJAX 1.0 )

Hello All,

I am doing a URL rewrite with help of Scott Mitchell's URL rewrite module. I am redircting all requests from abc.aspx to abc.html. This is working fine for me on normal aspx pages.

But when I am using AJAX v 1.0 on one page. I am not getting the AJAX behavior when page is request by URL rewrite .

Example I have a updatepanel on xyz.aspx. When I access that page bu url http://mysite/xyz.aspx all is working fine. But when I access page by URL http://mysite/xyz.html (for URL rewrite to work ) . AJAX is not working.

Any Ideas ??

Thanks

An ASPX page only works when served through the appropriate ISAPI filter. By changing the filetype, you're actually changing how the server will handle the file. Open IIS, right click your application and choose "Properties" Click on the "Configuration" button under Application Settings section. Add an entry for .html that mirrors the settings found for .aspx. That should force IIS to treat your renamed .html file as an ASPX page.

Hope this helps,

-Tony


Hello Tony,

We are doing that. All extensions are configured to be handled by ASP.NET worker process.

I think I need to check web.config for Ajax web services.

Thanks for reply