4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 02 Jun 2009, 12:48 PM
Hello Balaji,
Checkout the online demo which demonstrates how to bind the RadTreeView from code behind. You can also refer following links for more information on this. Hope this helps.
Data Binding Overview
Binding to DataTable, DataSet or DataView
Binding to Hierarchical Data
Thanks,
Shinu.
Checkout the online demo which demonstrates how to bind the RadTreeView from code behind. You can also refer following links for more information on this. Hope this helps.
Data Binding Overview
Binding to DataTable, DataSet or DataView
Binding to Hierarchical Data
Thanks,
Shinu.
0
balaji
Top achievements
Rank 1
answered on 03 Jun 2009, 06:39 AM
Sorry Shinu
It didnt work out.
Please Help me i need to sort out this probs
Actually i have a separate combo box which contains some values.
If i select the comboboxvalue i shuld bind the treeview using ajax.
I was doing this before using auto post back property.
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
sourceconnectionstring = "Data Source=" + DropDownList1.Text.ToString() + ";Initial Catalog=" + DropDownList3.Text + ";";
if (RadioButtonList2.SelectedItem.Text == "Windows")
{
sourceconnectionstring += "Integrated Security=SSPI";
}
else
{
TextBox3.Text = ViewState["pwd1"].ToString();
sourceconnectionstring += "User ID=" + TextBox5.Text + ";Password=" + TextBox3.Text + "";
}
try
{
sourcedbqry = "SELECT name as tblname FROM sys.Tables";
dbdt = new DataTable();
dbdt = dt.fetchvalues(sourceconnectionstring, sourcedbqry);
if (dbdt.Rows.Count > 0)
{
bindsourcetree(dbdt, sourceconnectionstring);
}
treeview1.Visible = true;
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
private void bindsourcetree(DataTable dts, string connections)
{
try
{
RadTreeNode radnodetbl = new RadTreeNode();
for (int i = 0; i < dts.Rows.Count; i++)
{
radnodetbl = new RadTreeNode();
radnodetbl.Text = dts.Rows[i][0].ToString();
radnodetbl.ImageUrl = "Images/tbl.jpg";
dt1 = new DataTable();
dt1 = dt.fetchvalues(connections, "select a.name from sys.columns a INNER JOIN sys.objects b ON a.object_id=b.object_id and b.name='" + dts.Rows[i][0].ToString() + "'");
if (dt1.Rows.Count > 0)
{
for (int j = 0; j < dt1.Rows.Count; j++)
{
RadTreeNode radcols = new RadTreeNode();
radcols.Text = dt1.Rows[j][0].ToString();
radcols.ImageUrl = "Images/columns.jpg";
radnodetbl.Nodes.Add(radcols);
}
}
RadTreeView1.Nodes.Add(radnodetbl);
}
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
am gettin gthe outpout as
It didnt work out.
Please Help me i need to sort out this probs
Actually i have a separate combo box which contains some values.
If i select the comboboxvalue i shuld bind the treeview using ajax.
I was doing this before using auto post back property.
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
sourceconnectionstring = "Data Source=" + DropDownList1.Text.ToString() + ";Initial Catalog=" + DropDownList3.Text + ";";
if (RadioButtonList2.SelectedItem.Text == "Windows")
{
sourceconnectionstring += "Integrated Security=SSPI";
}
else
{
TextBox3.Text = ViewState["pwd1"].ToString();
sourceconnectionstring += "User ID=" + TextBox5.Text + ";Password=" + TextBox3.Text + "";
}
try
{
sourcedbqry = "SELECT name as tblname FROM sys.Tables";
dbdt = new DataTable();
dbdt = dt.fetchvalues(sourceconnectionstring, sourcedbqry);
if (dbdt.Rows.Count > 0)
{
bindsourcetree(dbdt, sourceconnectionstring);
}
treeview1.Visible = true;
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
private void bindsourcetree(DataTable dts, string connections)
{
try
{
RadTreeNode radnodetbl = new RadTreeNode();
for (int i = 0; i < dts.Rows.Count; i++)
{
radnodetbl = new RadTreeNode();
radnodetbl.Text = dts.Rows[i][0].ToString();
radnodetbl.ImageUrl = "Images/tbl.jpg";
dt1 = new DataTable();
dt1 = dt.fetchvalues(connections, "select a.name from sys.columns a INNER JOIN sys.objects b ON a.object_id=b.object_id and b.name='" + dts.Rows[i][0].ToString() + "'");
if (dt1.Rows.Count > 0)
{
for (int j = 0; j < dt1.Rows.Count; j++)
{
RadTreeNode radcols = new RadTreeNode();
radcols.Text = dt1.Rows[j][0].ToString();
radcols.ImageUrl = "Images/columns.jpg";
radnodetbl.Nodes.Add(radcols);
}
}
RadTreeView1.Nodes.Add(radnodetbl);
}
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
am gettin gthe outpout as
0
balaji
Top achievements
Rank 1
answered on 03 Jun 2009, 06:39 AM
Sorry Shinu
It didnt work out.
Please Help me i need to sort out this probs
Actually i have a separate combo box which contains some values.
If i select the comboboxvalue i shuld bind the treeview using ajax.
I was doing this before using auto post back property.
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
sourceconnectionstring = "Data Source=" + DropDownList1.Text.ToString() + ";Initial Catalog=" + DropDownList3.Text + ";";
if (RadioButtonList2.SelectedItem.Text == "Windows")
{
sourceconnectionstring += "Integrated Security=SSPI";
}
else
{
TextBox3.Text = ViewState["pwd1"].ToString();
sourceconnectionstring += "User ID=" + TextBox5.Text + ";Password=" + TextBox3.Text + "";
}
try
{
sourcedbqry = "SELECT name as tblname FROM sys.Tables";
dbdt = new DataTable();
dbdt = dt.fetchvalues(sourceconnectionstring, sourcedbqry);
if (dbdt.Rows.Count > 0)
{
bindsourcetree(dbdt, sourceconnectionstring);
}
treeview1.Visible = true;
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
private void bindsourcetree(DataTable dts, string connections)
{
try
{
RadTreeNode radnodetbl = new RadTreeNode();
for (int i = 0; i < dts.Rows.Count; i++)
{
radnodetbl = new RadTreeNode();
radnodetbl.Text = dts.Rows[i][0].ToString();
radnodetbl.ImageUrl = "Images/tbl.jpg";
dt1 = new DataTable();
dt1 = dt.fetchvalues(connections, "select a.name from sys.columns a INNER JOIN sys.objects b ON a.object_id=b.object_id and b.name='" + dts.Rows[i][0].ToString() + "'");
if (dt1.Rows.Count > 0)
{
for (int j = 0; j < dt1.Rows.Count; j++)
{
RadTreeNode radcols = new RadTreeNode();
radcols.Text = dt1.Rows[j][0].ToString();
radcols.ImageUrl = "Images/columns.jpg";
radnodetbl.Nodes.Add(radcols);
}
}
RadTreeView1.Nodes.Add(radnodetbl);
}
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
am gettin gthe outpout as
It didnt work out.
Please Help me i need to sort out this probs
Actually i have a separate combo box which contains some values.
If i select the comboboxvalue i shuld bind the treeview using ajax.
I was doing this before using auto post back property.
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
sourceconnectionstring = "Data Source=" + DropDownList1.Text.ToString() + ";Initial Catalog=" + DropDownList3.Text + ";";
if (RadioButtonList2.SelectedItem.Text == "Windows")
{
sourceconnectionstring += "Integrated Security=SSPI";
}
else
{
TextBox3.Text = ViewState["pwd1"].ToString();
sourceconnectionstring += "User ID=" + TextBox5.Text + ";Password=" + TextBox3.Text + "";
}
try
{
sourcedbqry = "SELECT name as tblname FROM sys.Tables";
dbdt = new DataTable();
dbdt = dt.fetchvalues(sourceconnectionstring, sourcedbqry);
if (dbdt.Rows.Count > 0)
{
bindsourcetree(dbdt, sourceconnectionstring);
}
treeview1.Visible = true;
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
private void bindsourcetree(DataTable dts, string connections)
{
try
{
RadTreeNode radnodetbl = new RadTreeNode();
for (int i = 0; i < dts.Rows.Count; i++)
{
radnodetbl = new RadTreeNode();
radnodetbl.Text = dts.Rows[i][0].ToString();
radnodetbl.ImageUrl = "Images/tbl.jpg";
dt1 = new DataTable();
dt1 = dt.fetchvalues(connections, "select a.name from sys.columns a INNER JOIN sys.objects b ON a.object_id=b.object_id and b.name='" + dts.Rows[i][0].ToString() + "'");
if (dt1.Rows.Count > 0)
{
for (int j = 0; j < dt1.Rows.Count; j++)
{
RadTreeNode radcols = new RadTreeNode();
radcols.Text = dt1.Rows[j][0].ToString();
radcols.ImageUrl = "Images/columns.jpg";
radnodetbl.Nodes.Add(radcols);
}
}
RadTreeView1.Nodes.Add(radnodetbl);
}
}
catch (Exception ex)
{
Util.LogException(ex);
}
}
am gettin gthe outpout as
0
balaji
Top achievements
Rank 1
answered on 03 Jun 2009, 06:39 AM
c