Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Dropdownlist problem

Dropdownlist problem

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kissy16
    wrote on last edited by
    #1

    I have a problem with textbox and dropdownlist. My form contains ddl's,txt's and some other controls. On the pageload i am filling dropdown with some list. While Inserting values into database, for example,i am using a dropdownlist only for display.If i want to add some data of that dropdownlist kind,i am using textbox. The requirement is If i enter some text,it shd check in the dropdownlist.If it has the same value,it should focus on the dropdownlist value,so that user can select it.It will come into the textbox. This i want when he is trying to add some value(Not on the button click event,keyboard press time.).It should check from the dropdownlist values. Plese try to understand and solve my little problem. THanks in advnace. I am using asp.net 1.1,with sqlsever2000. REgards

    kissy

    P N 2 Replies Last reply
    0
    • K Kissy16

      I have a problem with textbox and dropdownlist. My form contains ddl's,txt's and some other controls. On the pageload i am filling dropdown with some list. While Inserting values into database, for example,i am using a dropdownlist only for display.If i want to add some data of that dropdownlist kind,i am using textbox. The requirement is If i enter some text,it shd check in the dropdownlist.If it has the same value,it should focus on the dropdownlist value,so that user can select it.It will come into the textbox. This i want when he is trying to add some value(Not on the button click event,keyboard press time.).It should check from the dropdownlist values. Plese try to understand and solve my little problem. THanks in advnace. I am using asp.net 1.1,with sqlsever2000. REgards

      kissy

      P Offline
      P Offline
      praveensri
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • K Kissy16

        I have a problem with textbox and dropdownlist. My form contains ddl's,txt's and some other controls. On the pageload i am filling dropdown with some list. While Inserting values into database, for example,i am using a dropdownlist only for display.If i want to add some data of that dropdownlist kind,i am using textbox. The requirement is If i enter some text,it shd check in the dropdownlist.If it has the same value,it should focus on the dropdownlist value,so that user can select it.It will come into the textbox. This i want when he is trying to add some value(Not on the button click event,keyboard press time.).It should check from the dropdownlist values. Plese try to understand and solve my little problem. THanks in advnace. I am using asp.net 1.1,with sqlsever2000. REgards

        kissy

        N Offline
        N Offline
        Nishant Singh
        wrote on last edited by
        #3

        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 :cool:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups