Gridview in Repeater
-
Hi All, let's suppose
DataSet ds = new DataSet();
ds.Tables.Add(datatable1)
ds.Tables.Add(datatable2);Repeater1.DataSource = ds;
then what would be the DataSource="?????" in gridview. Thanks,
-
Hi All, let's suppose
DataSet ds = new DataSet();
ds.Tables.Add(datatable1)
ds.Tables.Add(datatable2);Repeater1.DataSource = ds;
then what would be the DataSource="?????" in gridview. Thanks,
zeeShan anSari wrote:
Repeater1.DataSource = ds;
Is incorrect. If you have a
System.Data.DataSet
with multiple tables as a datasource, you must specify which table to bind to the control. Either:Repeater1.datasource = datatable1
//OR
Repeater1.datasource = ds.Tables[0]Same thing for GridView too.
GridView1.datasource = datatable1
//OR
GridView1.datasource = ds.Tables[0]Details here: MSDN: Repeater.DataSource Property [^] MSDN: BaseDataBoundControl.DataSource Property [^]
Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]
-
zeeShan anSari wrote:
Repeater1.DataSource = ds;
Is incorrect. If you have a
System.Data.DataSet
with multiple tables as a datasource, you must specify which table to bind to the control. Either:Repeater1.datasource = datatable1
//OR
Repeater1.datasource = ds.Tables[0]Same thing for GridView too.
GridView1.datasource = datatable1
//OR
GridView1.datasource = ds.Tables[0]Details here: MSDN: Repeater.DataSource Property [^] MSDN: BaseDataBoundControl.DataSource Property [^]
Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]
I don't think so. should: DataSource=Repeater1.DataSource
-
I don't think so. should: DataSource=Repeater1.DataSource
??? :confused:
Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]
-
Hi All, let's suppose
DataSet ds = new DataSet();
ds.Tables.Add(datatable1)
ds.Tables.Add(datatable2);Repeater1.DataSource = ds;
then what would be the DataSource="?????" in gridview. Thanks,
-
??? :confused:
Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]
DataSource connect Database , Not table.
-
Hi All, let's suppose
DataSet ds = new DataSet();
ds.Tables.Add(datatable1)
ds.Tables.Add(datatable2);Repeater1.DataSource = ds;
then what would be the DataSource="?????" in gridview. Thanks,
you can't set to table for repeater datasource, set it as one, or if you need each of them, use view in sql database, or use union linq method, that get it in one source! like this:
var ds = (table1)Union(table2).ToList();
repeater1.DataSource = ds;