lo que tengo es lo siguiente, pero lo que deseo es agregar una tabla mas pero no tiene un campo de relación con una de ellas
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BuscarTablaTema(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
if (!e.IsFromDetailTable)
{
RadGrid1.DataSource = ObtenerDatosTabla("SELECT * FROM Tema");
RadGrid1.MasterTableView.DataKeyNames = new string[] { "IdConocimiento" };
}
}
protected void BuscarTablaConocimiento(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
string IdConocimiento = dataItem.GetDataKeyValue("IdConocimiento").ToString();
e.DetailTableView.DataSource = ObtenerDatosTabla("SELECT * FROM Conocimiento WHERE IdConocimiento = '" + IdConocimiento + "'");
}
public DataTable ObtenerDatosTabla(string ConsultarTabla)
{
String ConnString = ConfigurationManager.ConnectionStrings["IgrupoLogosConnectionString"].ConnectionString;
SqlConnection conexionTabla = new SqlConnection(ConnString);
SqlDataAdapter adaptador = new SqlDataAdapter();
adaptador.SelectCommand = new SqlCommand(ConsultarTabla, conexionTabla);
DataTable DatosTabla = new DataTable();
conexionTabla.Open();
try
{
adaptador.Fill(DatosTabla);
}
finally
{
conexionTabla.Close();
}
return DatosTabla;
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BuscarTablaTema(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
if (!e.IsFromDetailTable)
{
RadGrid1.DataSource = ObtenerDatosTabla("SELECT * FROM Tema");
RadGrid1.MasterTableView.DataKeyNames = new string[] { "IdConocimiento" };
}
}
protected void BuscarTablaConocimiento(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;
string IdConocimiento = dataItem.GetDataKeyValue("IdConocimiento").ToString();
e.DetailTableView.DataSource = ObtenerDatosTabla("SELECT * FROM Conocimiento WHERE IdConocimiento = '" + IdConocimiento + "'");
}
public DataTable ObtenerDatosTabla(string ConsultarTabla)
{
String ConnString = ConfigurationManager.ConnectionStrings["IgrupoLogosConnectionString"].ConnectionString;
SqlConnection conexionTabla = new SqlConnection(ConnString);
SqlDataAdapter adaptador = new SqlDataAdapter();
adaptador.SelectCommand = new SqlCommand(ConsultarTabla, conexionTabla);
DataTable DatosTabla = new DataTable();
conexionTabla.Open();
try
{
adaptador.Fill(DatosTabla);
}
finally
{
conexionTabla.Close();
}
return DatosTabla;
}
}
}