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. Problem in filling drop down list

Problem in filling drop down list

Scheduled Pinned Locked Moved ASP.NET
helpcsharp
6 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.
  • J Offline
    J Offline
    Jain Vijay
    wrote on last edited by
    #1

    Hi, i m trying to fill my dropdownlist from dropdown object. in my class

    public DropDownList Bind_DdlBranch(int ZoneId)
    {
    DropDownList ddl = new DropDownList();
    clsMasterBranch obj = new clsMasterBranch();
    ddl.DataTextField = "testfieldname";
    ddl.DataValueField = "valuefieldname";
    ddl.DataSource = obj.MasterBranch_FetchByZoneId_DataSet(ZoneId);
    ddl.DataBind();

        return ddl;
    }
    

    here i m getting value in ddl object. but while i m trying to bind the ddl object to dropdownlist in my c# code

        clsDropDownList obj = new clsDropDownList();
        ddlBranch = obj.Bind\_DdlBranch(3);
    

    page was build with no error but drop down ddlBranch is empty... Plz guyz help me to find out the mistek.... thanx is advance....

    Regards... Vijay Jain :)

    "One thing you can't recycle is wasted time."

    B W 2 Replies Last reply
    0
    • J Jain Vijay

      Hi, i m trying to fill my dropdownlist from dropdown object. in my class

      public DropDownList Bind_DdlBranch(int ZoneId)
      {
      DropDownList ddl = new DropDownList();
      clsMasterBranch obj = new clsMasterBranch();
      ddl.DataTextField = "testfieldname";
      ddl.DataValueField = "valuefieldname";
      ddl.DataSource = obj.MasterBranch_FetchByZoneId_DataSet(ZoneId);
      ddl.DataBind();

          return ddl;
      }
      

      here i m getting value in ddl object. but while i m trying to bind the ddl object to dropdownlist in my c# code

          clsDropDownList obj = new clsDropDownList();
          ddlBranch = obj.Bind\_DdlBranch(3);
      

      page was build with no error but drop down ddlBranch is empty... Plz guyz help me to find out the mistek.... thanx is advance....

      Regards... Vijay Jain :)

      "One thing you can't recycle is wasted time."

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      if

      obj.MasterBranch_FetchByZoneId_DataSet(ZoneId);

      return DataSet then rty to find the index of table e.g.

      ddl.DataSource = obj.MasterBranch_FetchByZoneId_DataSet(ZoneId).Tables[0];


      I Love T-SQL "VB.NET is developed with C#.NET" If my post helps you kindly save my time by voting my post.

      J 1 Reply Last reply
      0
      • B Blue_Boy

        if

        obj.MasterBranch_FetchByZoneId_DataSet(ZoneId);

        return DataSet then rty to find the index of table e.g.

        ddl.DataSource = obj.MasterBranch_FetchByZoneId_DataSet(ZoneId).Tables[0];


        I Love T-SQL "VB.NET is developed with C#.NET" If my post helps you kindly save my time by voting my post.

        J Offline
        J Offline
        Jain Vijay
        wrote on last edited by
        #3

        thax for reply.... but

        obj.MasterBranch\_FetchByZoneId\_DataSet(ZoneId);
        

        returning value to the dataset... my problem is that

        clsDropDownList obj = new clsDropDownList();
        ddlBranch = obj.Bind_DdlBranch(3);

        is not binding data to the physical dropdownlist. where

        obj.Bind_DdlBranch(3);

        is returning the dropdownlist

        Regards... Vijay Jain :)

        "One thing you can't recycle is wasted time."

        B 1 Reply Last reply
        0
        • J Jain Vijay

          thax for reply.... but

          obj.MasterBranch\_FetchByZoneId\_DataSet(ZoneId);
          

          returning value to the dataset... my problem is that

          clsDropDownList obj = new clsDropDownList();
          ddlBranch = obj.Bind_DdlBranch(3);

          is not binding data to the physical dropdownlist. where

          obj.Bind_DdlBranch(3);

          is returning the dropdownlist

          Regards... Vijay Jain :)

          "One thing you can't recycle is wasted time."

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          Did you try to

          Bind()

          ddlBranch control after you call function which return DropDownList e.g/

          clsDropDownList obj = new clsDropDownList();
          ddlBranch = obj.Bind_DdlBranch(3);
          ddlBranch.DataBind();


          I Love T-SQL "VB.NET is developed with C#.NET" If my post helps you kindly save my time by voting my post.

          J 1 Reply Last reply
          0
          • B Blue_Boy

            Did you try to

            Bind()

            ddlBranch control after you call function which return DropDownList e.g/

            clsDropDownList obj = new clsDropDownList();
            ddlBranch = obj.Bind_DdlBranch(3);
            ddlBranch.DataBind();


            I Love T-SQL "VB.NET is developed with C#.NET" If my post helps you kindly save my time by voting my post.

            J Offline
            J Offline
            Jain Vijay
            wrote on last edited by
            #5

            sorry.... i forgot to copy that line in my code... but i have already do that...

            Regards... Vijay Jain :)

            "One thing you can't recycle is wasted time."

            1 Reply Last reply
            0
            • J Jain Vijay

              Hi, i m trying to fill my dropdownlist from dropdown object. in my class

              public DropDownList Bind_DdlBranch(int ZoneId)
              {
              DropDownList ddl = new DropDownList();
              clsMasterBranch obj = new clsMasterBranch();
              ddl.DataTextField = "testfieldname";
              ddl.DataValueField = "valuefieldname";
              ddl.DataSource = obj.MasterBranch_FetchByZoneId_DataSet(ZoneId);
              ddl.DataBind();

                  return ddl;
              }
              

              here i m getting value in ddl object. but while i m trying to bind the ddl object to dropdownlist in my c# code

                  clsDropDownList obj = new clsDropDownList();
                  ddlBranch = obj.Bind\_DdlBranch(3);
              

              page was build with no error but drop down ddlBranch is empty... Plz guyz help me to find out the mistek.... thanx is advance....

              Regards... Vijay Jain :)

              "One thing you can't recycle is wasted time."

              W Offline
              W Offline
              www Developerof NET
              wrote on last edited by
              #6

              First of all, How is your dropdown list added in the UI? Please make sure you are adding the same dropdown returned from the function in a panel or a table. Secondly do check if your dropdown is filled while debugging in your function scope (Bind_DdlBranch in this case). Hope that helps...

              When you fail to plan, you are planning to fail.

              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