This is a migrated thread and some comments may be shown as answers.

Update some fields with a GridDropDownColumn

2 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fecteaum
Top achievements
Rank 1
fecteaum asked on 11 Sep 2008, 08:29 PM
I want to know is it's possible to changed the values of some textbox and dropdownlistbox fields when a select a value form an another dropdownlistbox in edit mode frorm a radgrid.

explanation: I have a grid containing a product number w(hich is a dropdownlistbox in edit mode), a description, mark, model unit_price (which they are textboxs) and Mesure_unit (which is a dropdownlistbox). 

If the client select a product number from the 1st dropdown i want to fill all the others fields with the value that i have in my database.

If the client don't select a product form de 1st dropdown they have to enter all the values for the others fields.

Is this possible

Thank you

2 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 14 Sep 2008, 08:51 PM
Hi fecteaum,

This requirement can be implemented both on the client and on the server, by enabling AutoPostback for the first dropdown list. On the server, all you need to do is find your sibling controls by ID and set their properties:

void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) 
    DropDownList ddlist = sender as DropDownList; 
    (ddlist.NamingContainer.FindControl("DropDownList2"as DropDownList).Items.Add("value"); 
    (ddlist.NamingContainer.FindControl("TextBox1"as TextBox).Text = "Some text"
    //... 

To achieve the same on the client, you can choose an event from the first dropdown to attach to, similarly find the other controls and set their values.

Best wishes,
Veli
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 15 Sep 2008, 07:51 AM
Hi fecteaum,

You can also refer the following online demo which demonstrates a similar scenario in edit mode.
Accessing cells and rows

Thanks
Shinu.
Tags
Grid
Asked by
fecteaum
Top achievements
Rank 1
Answers by
Veli
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or