Monday, March 26, 2012

My first Ajax use

Hello Friends

I am having a DropDownList "lstTitle" that read its values from SqlDataSourse "DSTitles" and a Label "lblNewTitle" i add a java script to the lblNewTitle like that:

lblNewTitle.Text ="<a href='javascript:window.open(\"AddNewTitle.aspx\",\"window\",\"HEIGHT=272,WIDTH=440,top=250,left=250,toolbar=no,scrollbars=yes,resizable=yes\");%20void(0);'>New Title</a>";

so when press on that label a new window appear that enable the user to enter a new title in to my sql 2000 database.

The problem is how to show this new entered title in the lstTitle without a PostPack action.

Note: i add to my page a ScriptManager and and UpdatePanel and put "DSTitle,lstTitle and lblNewTitle" inside the UpdatePanel and use a Timer with an interval of 1 second but nothing change.

So, where is the problem.

Please help me.

Hi.

Label1.Attributes.Add("onClick", "javascript:window.open('Default.aspx',height=272,width=500)");

This will help you.. sure...Remove your first logic and write this intoyour page load event and test it.

Thanks


I just have a script error "Error: 'Sys' is undefined i think the problem is in the following includes:

<%@. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>

Hello,

not answering question, but just throwing an idea out: how about using the modalpopupextender instead of a popup window?


Thanks i found the solution.

I create a new website AJAXEnabledWebsite and but a script manager, UpdatePanel "and but the control inseide" and a Timer with an interval of 9 sec and a Tick event.

Inside Timer event handler i put:

lstTitle.DataBind();

lstTitle.SelectedValue = selected;

No comments:

Post a Comment