Showing posts with label text. Show all posts
Showing posts with label text. Show all posts

Wednesday, March 28, 2012

How do I update text in a panel using ajax and a timer?

This is a pretty basic question, I just need to update a textbox every few minutes without using a postback. The text is pulled from a sql query. Is there a example for how to do this somewhere? (simialar to how gmail updates, etc...)

Take a look at this: http://encosia.com/index.php/2007/07/25/display-data-updates-in-real-time-with-ajax/

If you're only updating a simple text label, you could skip the UpdatePanel in my example andupdate that text on the client side, using a web method.

A combination of those two examples should give you what you're after.


Thanks for providing links.

Monday, March 26, 2012

How do I display a simple message box using Ajax?

I'm doing a check to make sure that at least one out of 5 search text fields are entered. If none are entered, I want to display a message saying so. How do I do this?

The following works if I do not use Ajax:

DisplayClientError("My message to be displayed here");

privatevoid DisplayClientError(string errorDesc)

{

string script ="<script language=\"javascript\">alert('" + errorDesc +"');</script>";ClientScript.RegisterStartupScript(typeof(Page),"UserSecurity", script);

}

But this doesn't show up in Ajax version.

Thanks.

Use ScriptManager.RegisterStartupScript() instead.


Try this

privatevoid DisplayClientError(string errorDesc)

{

string script ="alert('" + errorDesc +"');";

ScriptManager.RegisterStartupScript(this,typeof(Page),"UserSecurity", script,true);

}


Oh !!!! I see what's happening now. Thanks a lot.


thx for that !!Smile

How do I change the Content in Accordion?

Is there any way to change text of the Content in Accordion dynamic?Hi falconyin,

Yes - you can access MyAccordion.Panes[0].Content.ContentContainer which derives from Panel, or you can include an <asp:Label> that you get access to with MyAccordion.FindControl.

Thanks,
Ted

How do I change a labels text (twice) in an UpdatePanel?

Hey,

I would like for a user to click an 'Add to Cart' Button, a message appears 'Adding Item to Cart ...', and then the message changes to 'Item added to Cart' when finished. I have under the AddToCart_Click event changing the label to 'Adding to Shopping Cart ...' then the code to actually add the item to the shopping cart and then changing the label to 'Item added to Cart.' However, only the last label is seen (Item added to Cart). Any suggestions on how to do this? Should I use 2 Update Panels? Or, how do I tell it to display both labels?

Thanks,
Beej

Hi

I am not sure about this, but please check Update progress or timer control from Ajax.Net. It may help you.

regards

Anuraj.P


I would suggest using the UpdateProgress component from the AjaxControlToolkit. What you specify in the ProgressTemplate tag of the UpdateProgress control will be visible during the callback, in your case the message 'Adding item to cart...'


SplashMan:

Hey,

I would like for a user to click an 'Add to Cart' Button, a message appears 'Adding Item to Cart ...', and then the message changes to 'Item added to Cart' when finished. I have under the AddToCart_Click event changing the label to 'Adding to Shopping Cart ...' then the code to actually add the item to the shopping cart and then changing the label to 'Item added to Cart.' However, only the last label is seen (Item added to Cart). Any suggestions on how to do this? Should I use 2 Update Panels? Or, how do I tell it to display both labels?

Thanks,
Beej

hi,

Subscribe to add_beginRequest and add_endRequest events of the Sys.WebForms.PageRequestManager like so:

<script type="text/javascript">
//<![CDATA[
var prm = Sys.WebForms.PageRequestManager.getInstance();
var displayLabel= $get("displayText");

prm.add_beginRequest(function(){
displayLabel.innerHTML = "Adding Item To Cart ...";
});

prm.add_endRequest(function(){
displayLabel.innerHTML = "Item added to Cart ...";
});
//]]>
</script>

hth

Saturday, March 24, 2012

how can i use AjaxControlToolkit.resources.dll to use ajax with arabic language?

Hello.

I'm using ajax control toolkit and I'm having some difficulties , the direction and the alignment of the text can't be changed.

and in arabic it is different from english.

So how can i use the AjaxControlToolkit.resources.dll to apply the arabic language?

thanks

Hi,

You may specify the culture for the application in web.config. In globalization section.

For instance:
<globalization culture="en-us"/>

And you can refer to following documentations for more information:

http://msdn2.microsoft.com/en-us/library/c6zyy3s9.aspx
http://msdn2.microsoft.com/en-us/library/hy4kkhe0(VS.71).aspx

Hope this helps.