using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class ClientCallback : System.Web.UI.Page, System.Web.UI.ICallbackEventHandler { protected System.Collections.Specialized.ListDictionary catalog; protected String returnValue; protected void Page_Load(object sender, EventArgs e) { String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context"); String callbackScript; callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + ";}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); if(!Page.IsPostBack) { ddstate.DataSource = objnewdoc.fillddstate(); ddstate.DataValueField = objnewdoc.fillddstate().Tables[0].Columns[0].ToString(); ddstate.DataTextField = objnewdoc.fillddstate().Tables[0].Columns[1].ToString(); ddstate.DataBind(); ddstate.Items.Capacity = ddstate.Items.Capacity + 1; ListItem lt = new ListItem(); lt.Text = "<-Select State->"; lt.Value = "0"; ddstate.Items.Insert(0, lt); ListItem ltcity = new ListItem(); ltcity.Text = "<-Select->"; ltcity.Value = "0"; ddcity.Items.Insert(0, ltcity); } //catalog = new System.Collections.Specialized.ListDictionary(); //catalog.Add("monitor", 12); //catalog.Add("laptop", 10); //catalog.Add("keyboard", 23); //catalog.Add("mouse", 17); //ListBox1.DataSource = catalog; //ListBox1.DataTextField = "key"; //ListBox1.DataBind(); } public void RaiseCallbackEvent(String eventArgument) { if (catalog[eventArgument] == null) { returnValue = "-1"; } else { DataSet dsCity = objnewdoc.GetCityID(eventArgument); returnValue = dsCity.Tables[0].Rows[0][0].ToString(); for (int cnt = 1; cnt < dsCity.Tables[0].Rows.Count; cnt++) { returnValue = returnValue + "," + dsCity.Tables[0].Row
P
praveensri
@praveensri