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

Pass data from Dropdown and Text to the Grid

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Musab Alghzawi
Top achievements
Rank 1
Musab Alghzawi asked on 30 Mar 2010, 09:10 AM
Hello,

If anyone can guide me what the best solution I should do to achieve the following:

I have a master page.
In the master page I have a dropdownlist and a textbox
I wannna be able to select an item from the dropdownlist and type the text to search for according to the selected item

then pass that select statement to the RadGrid in the ContentForm.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Mar 2010, 11:19 AM
Hi,

You can achieve this by accessing the master page controls from content page. You could use FindControl() method for accessing the controls from master page and generate query as per your requirement. Check out the sample code below.

C#:
DropDownList ddlSearchField = (DropDownList)((MasterPage)this.Master).FindControl("ddlSearchField"); 
TextBox txtSearchKey = (TextBox)((MasterPage)this.Master).FindControl("txtSearchKey"); 
string query = "select * from Customers where " + ddlSearchField.SelectedItem.Text + " = '" + txtSearchKey.Text.Trim() + "';"
RadGrid1.DataSource = getUserDetails(query); 

Thanks
Princy
0
Musab Alghzawi
Top achievements
Rank 1
answered on 30 Mar 2010, 02:11 PM
Great , this is better than using request and response query strings.


thank you !

p.s. in that grid I'm gonna generate, how can keep track of the first column in the selected row.

I remember in ASP.NET grid I use selectedRow.cells[1]

How can I do that in telerik grid ?

Tags
Grid
Asked by
Musab Alghzawi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Musab Alghzawi
Top achievements
Rank 1
Share this question
or