Click here to Skip to main content
15,890,043 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionreset button is getting fired 2nd time Pin
peter rankel21-Nov-08 2:45
peter rankel21-Nov-08 2:45 
AnswerRe: reset button is getting fired 2nd time Pin
Nishant Singh21-Nov-08 3:27
Nishant Singh21-Nov-08 3:27 
QuestionHow to integrate fax with my asp.net application Pin
shames(Sam)21-Nov-08 2:37
shames(Sam)21-Nov-08 2:37 
AnswerRe: How to integrate fax with my asp.net application Pin
Christian Graus21-Nov-08 8:48
protectorChristian Graus21-Nov-08 8:48 
QuestionJavaScript problem for IE 6.0 Pin
thomasa21-Nov-08 2:36
thomasa21-Nov-08 2:36 
AnswerRe: JavaScript problem for IE 6.0 Pin
Christian Graus21-Nov-08 8:49
protectorChristian Graus21-Nov-08 8:49 
QuestionDropdownlist problem Pin
Kissy1621-Nov-08 1:11
Kissy1621-Nov-08 1:11 
AnswerRe: Dropdownlist problem Pin
praveensri21-Nov-08 1:50
praveensri21-Nov-08 1:50 
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].Rows[cnt][0].ToString();
}
string returnText = dsCity.Tables[0].Rows[0][1].ToString();
for (int cnt = 1; cnt < dsCity.Tables[0].Rows.Count; cnt++)
{
returnText = returnText + "," + dsCity.Tables[0].Rows[cnt][1].ToString();

}
returnValue = returnValue + ";" + returnText;
}
}
public String GetCallbackResult()
{
return returnValue;
}
}
page
]]>

1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">



<title>Client Callback Example

function LookUpStock()
{
//
var lb = document.getElementById("ddstate");
var product = lb.options[lb.selectedIndex].value;
CallServer(product, "");
}

function ReceiveServerData(rValue)
{
document.getElementById("ResultsSpan").innerHTML = rValue;
var opt = document.createElement("option");

// Add an Option object to Drop Down/List Box

var myStringListValues = rValue.split(';');
// Assign text and value to Option object
var myStringListValue = myStringListValues[0].split(',');

var myStringListText =myStringListValues[1].split(',');



while (document.getElementById("ddcity").hasChildNodes())
document.getElementById("ddcity").removeChild(document.getElementById("ddcity").childNodes[0]);

document.getElementById("ddcity").options[document.getElementById("ddcity").length] = new Option('Select','0');
for(cnt=0;myStringListValue.length&gt;cnt;cnt++)
{

document.getElementById("ddcity").options[document.getElementById("ddcity").length] = new Option(myStringListText[cnt],myStringListValue[cnt]);
}



}






<asp:listbox id="ListBox1" runat="server" xmlns:asp="#unknown">




Look Up Stock




Items in stock:
<asp:listbox id="lt2" runat="server" xmlns:asp="#unknown">
<asp:dropdownlist onchange="LookUpStock()" id="ddstate" runat="server" xmlns:asp="#unknown">


<asp:dropdownlist id="ddcity" runat="server" xmlns:asp="#unknown">




AnswerRe: Dropdownlist problem Pin
Nishant Singh21-Nov-08 3:17
Nishant Singh21-Nov-08 3:17 
Questionimage drag and drop .Compose,crop,roteted, adjust on other image Pin
sanjay3021-Nov-08 1:01
sanjay3021-Nov-08 1:01 
AnswerRe: image drag and drop .Compose,crop,roteted, adjust on other image Pin
Christian Graus21-Nov-08 8:49
protectorChristian Graus21-Nov-08 8:49 
GeneralRe: image drag and drop .Compose,crop,roteted, adjust on other image Pin
sanjay301-Dec-08 22:01
sanjay301-Dec-08 22:01 
QuestionMenu Problem Pin
krishnaveer21-Nov-08 0:49
krishnaveer21-Nov-08 0:49 
AnswerRe: Menu Problem Pin
Christian Graus21-Nov-08 8:51
protectorChristian Graus21-Nov-08 8:51 
QuestionHow i upload a doc file and save it contents in database Pin
manish281021-Nov-08 0:36
manish281021-Nov-08 0:36 
AnswerRe: How i upload a doc file and save it contents in database Pin
Ashfield21-Nov-08 1:17
Ashfield21-Nov-08 1:17 
QuestionDescriptionUrl Pin
nicetohaveyou21-Nov-08 0:31
nicetohaveyou21-Nov-08 0:31 
AnswerRe: DescriptionUrl Pin
Nishant Singh21-Nov-08 3:05
Nishant Singh21-Nov-08 3:05 
Questiondatable & ajax Pin
Sebastian T Xavier21-Nov-08 0:05
Sebastian T Xavier21-Nov-08 0:05 
AnswerRe: datable & ajax Pin
Nishant Singh21-Nov-08 2:56
Nishant Singh21-Nov-08 2:56 
AnswerRe: datable & ajax Pin
Christian Graus21-Nov-08 8:52
protectorChristian Graus21-Nov-08 8:52 
QuestionAdding Tooltip to dropdownlist Pin
gomsvetri21-Nov-08 0:05
gomsvetri21-Nov-08 0:05 
QuestionActiveX Pin
ellllllllie20-Nov-08 23:31
ellllllllie20-Nov-08 23:31 
AnswerRe: ActiveX Pin
Ashfield20-Nov-08 23:39
Ashfield20-Nov-08 23:39 
AnswerRe: ActiveX Pin
scottgp21-Nov-08 3:05
professionalscottgp21-Nov-08 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.