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

Server side Event Selected Item value

1 Answer 94 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
NA
Top achievements
Rank 1
NA asked on 18 Jan 2014, 01:57 PM
How to get the selected Item Value and at time that value go to input to  radgrid

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Jan 2014, 02:50 AM
Hi,

Please have a look into the following code snippet to achieve your scenario.

ASPX:
<telerik:RadDropDownTree ID="RadDropDownTree1" runat="server" AutoPostBack="true"
    DataSourceID="SqlDataSource1" DataTextField="text" DataFieldParentID="parentid"
    DataFieldID="id" OnEntryAdded="RadDropDownTree1_EntryAdded">
</telerik:RadDropDownTree>
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" Visible="false">
</telerik:RadGrid>

C#:
protected void RadDropDownTree1_EntryAdded(object sender, Telerik.Web.UI.DropDownTreeEntryEventArgs e)
{
    String connstring = WebConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(connstring);
    SqlDataAdapter adapter = new SqlDataAdapter();
    adapter.SelectCommand = new SqlCommand("SELECT * from Details WHERE text LIKE '" + e.Entry.Text + "%'", conn);
    DataTable data = new DataTable();
    conn.Open();
    try
    {
        adapter.Fill(data);
    }
    finally
    {
        conn.Close();
    }
    RadGrid1.Visible = true;
    RadGrid1.DataSource = data;
    RadGrid1.DataBind();
}

Let me know if you have any concern.
Thanks,
Shinu.
Tags
DropDownTree
Asked by
NA
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or