
<span contenteditable="false" unselectable="on" style="-moz-user-select: none;-webkit-user-select: none;
;"> <script type="text/javascript"> function example(){ } </script><table> <tbody> <tr> <td>test</td> </tr> </tbody></table></span>
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500I created a RadGrid programmatically, and i use the following lines:
RadGrid2.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid2_NeedDataSource);
instead of --->
RadGrid2.DataSourceID = "SqlDataSource1";
i want to create a GridTableView like the above line
GridTableView tableViewOrders = new GridTableView(RadGrid2);
¿¿ what should be the declaration to replace ----> tableViewOrders.DataSourceID = "SqlDataSource2"; ???
i think somesthing like --->
tableViewOrders.NestedViewSettings.DataSourceID += new GridNestedViewSettings(RadGrid3_NeedDataSource);
but it is incorrect.
tableViewOrders.DataKeyNames =
new string[] { "idCodigos" };
GridRelationFields relationFields = new GridRelationFields();
relationFields.MasterKeyField =
"idCodigo";
relationFields.DetailKeyField =
"idCodigoSubGrupo";
tableViewOrders.ParentTableRelation.Add(relationFields);
RadGrid2.MasterTableView.DetailTables.Add(tableViewOrders);
protected
void RadGrid2_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
ConnectionStringSettings connectionString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"];
_connection =
DbProviderFactories.GetFactory(connectionString.ProviderName).CreateConnection();
_connection.ConnectionString = connectionString.ConnectionString;
IDataReader reader;
using (IDbCommand command = _connection.CreateCommand())
{
command.CommandText =
"SpName";
command.CommandType =
CommandType.StoredProcedure;
_connection.Open();
reader = command.ExecuteReader();
}
((
RadGrid)source).DataSource = reader;
}
protected void RadGrid2_DataBound(object sender, EventArgs e)
{
if (_connection.State == ConnectionState.Open)
{
_connection.Close();
}
}
thanks in advance
Cristian.-