|
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>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">
|
|
|
|
|
Hi,
If I am not wrong you want to check whether the value you are entering in textbox already exist in DropDown ?
Well U can extensively use JavaScript for this purpose,
On KeyPress event of the TextBox
Compare the Value in TextBox with DropDownList options
if it matches any Value of DropDownList using substring method
(ie if Text in the Textbox is found to be the Substring of any existing value of DropDownList Set that option as selected )
This should be the approach according to me.
Give me a Day or 2 iwill try to implement it myself
|
|
|
|
|
Hi any one help me ,
i want drag and drop image on other image after adjust by crop,roteted,compose and save in database (ms-access)in asp.net
Towards the success..
|
|
|
|
|
Sounds like a lot of work. You'd better get started, or perhaps start looking to buy a library to give you all that.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
sir please make it more clear,
|
|
|
|
|
Hi guys
I have one problem with menu control
I built a web application in which menu is displaying
in flash file through which i am passing querry string
and displaying that particular page.
Priviously there was only 100 Category
But now its increase and its become 500
as per clint, in future it may be increase
so i want this menu as dynamic menu, but this menu will
display 15 category at a time and after scrolling it
will show different one
so what will be solution please suggest me
krishna veer singh
|
|
|
|
|
Your menu is written in flash ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello friends,
Thanks for your ll time support.
I would like to do .. uploading a doc. file and save it contents in database after reading and then show it contents on a webpage in view mode.
Please help out ...
Manish
|
|
|
|
|
Its too complex to give you details, but this has been the subject of several articles. Search here on CP for "upload file" or "save file to database" and you should find enough information to help you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
What is the purpose of DescriptionUrl?
As i have just placed a code:
Image1.ImageUrl = "~/logo.gif"
Image1.DescriptionUrl = "D:\a.html"
Image1.AlternateText = "Logo"
so that a logo appeared with tip as Logo but i did not understand why DescriptionUrl was placed.
Your help is appreciated...........
|
|
|
|
|
|
Hi,
How can I access the datatable in ajax which is returned from a function...
can I have any examples?
Thanks
Sebastian
|
|
|
|
|
Hi Sebastian,
Datatable can be used in Ajax ,but it needs to be returned as XML from the Server page ,and then that XML can be parsed and the desired task could be done .
eg: in this code in am converting a DataTable into XML string
(This code is on Ajax Server page which returns XML string to Client page which Implements ajax)
public partial class DataAccessAjax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string result;
DataTable dataTable=GetEmpRecords(); --function returning Dataset
using (StringWriter sw = new StringWriter()) {
dataTable.WriteXml(sw);
result = sw.ToString();
}
Response.Write(result);
Response.End();
}
Now XML string is returned of datatable could be used for Ajax implementaion at clientside
|
|
|
|
|
Do you mean AJAX, or ASP.NET AJAX, a library for people who don't want to learn how to write AJAX code ? What are you trying to do exactly ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hi,
i want to add tooltip to dropdownlist i am using the below code
private void BindTooltip2()
{
for (int i = 0; i < ddlJob.Items.Count; i++)
{
ddlJob.Items[i].Attributes.Add("title", ddlJob.Items[i].Text);
}
}
but this one is not working in safari browsers .
its working in mozilla,netscape only
give some idea to solve this
|
|
|
|
|
Hello,
i get the following error : ActiveXobject is not defined
Any help
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
ellllllllie wrote: ActiveXobject is not defined
Well define it then. With the details you have supplied thats about all I can suggest.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
How can you possibly expect any help with such a useless title and so little provided information?
|
|
|
|
|
Be more descriptive of what is causing this error. I.e. offending code?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
iam calling a window.open when a button is clicked through javascript.
the problem is that it is getting minimised when ever it is opened .how to solve the problem.
|
|
|
|
|
Use This i hope it will help u
function OpenNewCust()
{
window.open("Default.aspx","Title","status=yes,toolbar=no,width=550, height=600, menubar=no,location=no,scrollbars=yes,left=350,top=165");
return false;
}
Thanks & Regards,
Prashant B. Lavate
Software Engineer
Mobile : +919423872257
Pune(India)
|
|
|
|
|
Hi,
I am using .net 2.0. In my project I have a gridview in a table. In that gridview I have ImageButtons in the ItemTemplate tag. When I run the project it works fine in Mozila. But in IE 6.0, the image buttons are not wrapped the text in its datafield and the whole table design is collapsed. Please give me an idea to design the ImageButton that will suit all browsers.
Thanking You.
|
|
|
|
|
IE6 is almost certainly deviating from the standard. If you're using a standard server control, the framework should deal with it. You need to look at the generated HTML and work out how to change it so that it works in IE6.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
i need to inactive one dropdownlist while we select item "Photo prints " in another dropdown list. and i need to display a text in txtcomment "My order is of minimum Rs. 2,500.".
i am sending my code pls help me...
If Not Page.IsPostBack Then
Me.ddlproduct.Items.Add("Select")
Me.ddlproduct.Items.Add("Photo Prints")
'If Me.ddlproduct.SelectedValue = "Photo Prints" Then
' 'Me.ddlquantity.Enabled = False
' txtcomment.Text = "My order is of minimum Rs. 2,500."
'End If
Me.ddlproduct.Items.Add("Custom Calendars")
Me.ddlproduct.Items.Add("Collage Posters")
Me.ddlproduct.Items.Add("Greeting Cards")
Me.ddlproduct.Items.Add("Photo Mugs")
Me.ddlproduct.Items.Add("Zoomini Books")
Me.ddlproduct.Items.Add("Zoomin T-Shirts")
Me.ddlquantity.Items.Add("Select")
Me.ddlquantity.Items.Add("30-50")
Me.ddlquantity.Items.Add("51-100")
Me.ddlquantity.Items.Add("101 & Above")
End If
and
Protected Sub ddlproduct_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlproduct.SelectedIndexChanged
If Me.ddlproduct.SelectedValue = "Photo Prints" Then
Me.ddlquantity.Enabled = False
txtcomment.Text = "My order is of minimum Rs. 2,500."
End If
End Sub
Thanks
Subbu.
|
|
|
|
|
This is ugly, but I'd expect it to work, so long as the autopostback on the control is true. I'd do this in javascript tho, not via a postback.
It's hard to know what's wrong when you don't tell us what happens when you try to use the code. Does the event fire ? In the debugger, does Me.dllproduct.SelectedValue equal what you expect ? Is the issue that you never reenable dllquantity and clear txtcomment, if something else is selected ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|