Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Location
    Memphis, TN
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dropdown list in gridview

    Hello,
    Im having an issue retrieving the value of a databound dropdownlist inside of a gridview. I thought maybe that i could get the value on the selelectedindexchange but still it does not work.

    The dropdownlist contains a list of employees the datatextfield is their name and the value field is their employeeid. My goal is once the employee has been changed i want a text box ,3 columns over, to populate with the employee billing rate.


    Please help....

    Thanks in advance
    Josh

  • #2
    New Coder
    Join Date
    Oct 2005
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK go throug the url
    http://www.gridviewguy.com/ArticleDe...x?articleID=85
    hope it will help u
    warm Regards
    Abhishek Goel
    Software Developer at Handdshakeit (Handshake Infotech Pvt. Ltd)
    --------------------------------------------------
    ActiveX HTML Editor control

  • #3
    New to the CF scene
    Join Date
    Feb 2006
    Location
    Memphis, TN
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DIdnt help

    Thanks for answering me
    the url that you sent me to was unable to aid me in any way. I dont want to retrieve the uniqueid of the entire row however i do want to retirieve the uniquieid/employeeid of the selectedvalue in the dropdownlist which is a template column within the gridview.

    Thanks

  • #4
    $object->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Jun 2003
    Posts
    3,085
    Thanks
    2
    Thanked 23 Times in 23 Posts
    Does this article help?
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    SNAP to it!

  • #5
    New to the CF scene
    Join Date
    Feb 2006
    Location
    Memphis, TN
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update

    well so far i have figured out that i can get the textbox to populate when i select an item in the dropdown. I have that part working now but the one problem still remains is when i try to add multiple rows in the gridview.

    Heres my code:

    protected void dropTech_SelectedIndexChanged(object sender, EventArgs e)
    {
    ContentPlaceHolder mpContentPlaceHolder;
    GridView mpControl;

    mpContentPlaceHolder =
    (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");

    mpControl = (GridView)mpContentPlaceHolder.FindControl("gvLabor");

    //int iRowID = mpControl.FindControl("lbl

    //extract the employeeid for the employee that is selected
    int iEmployeeID = Convert.ToInt32(((DropDownList)mpControl.Rows[0].Cells[0].Controls[0].FindControl("dropTech")).SelectedItem.Value);
    //int iEmployeeID = Convert.ToInt32(((DropDownList)mpControl.Rows[].Cells[1].Controls[0].FindControl("dropTech")).SelectedItem.Value);

    //get that employee billing rate
    DataSet dsBillingRate = new DataSet();
    dsBillingRate = VMBO.instance.getEmployeeBillingRate(iEmployeeID);

    Decimal dBillingRate;

    foreach (DataRow drBillingRate in dsBillingRate.Tables[0].Rows)
    {
    dBillingRate = (Decimal)drBillingRate["BillingRate"];

    //now make the textbox have that value
    ((TextBox)mpControl.Rows[0].Cells[0].Controls[0].FindControl("txtRate")).Text = Convert.ToString(dBillingRate);

    }
    }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •