6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 14 Jan 2013, 06:05 AM
Hi,
Try setting the RadGrid Property PageSize to '5' as shown below.
ASPX:
Thanks,
Shinu.
Try setting the RadGrid Property PageSize to '5' as shown below.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
PageSize
=
"5"
AllowPaging
=
"true"
. . .>
Thanks,
Shinu.
0
Venkatesh
Top achievements
Rank 1
answered on 14 Jan 2013, 06:12 AM
Hi,
Thanks for the reply.
Sorry for the confusion caused. I am not looking for paging.
I am looking for the below:
By default the user should be able to enter 5 rows one below the other.. when the user sees the grid, it should have 5 new rows created.
Thanks for the reply.
Sorry for the confusion caused. I am not looking for paging.
I am looking for the below:
By default the user should be able to enter 5 rows one below the other.. when the user sees the grid, it should have 5 new rows created.
0
Shinu
Top achievements
Rank 2
answered on 15 Jan 2013, 04:00 AM
Hi,
I am not quite sure about your requirement. Please check the sample code snippet i tried to show 5 blank rows in RadGrid.
ASPX:
C#:
Please elaborate your scenario if this doesn't help.
Thanks,
Shinu.
I am not quite sure about your requirement. Please check the sample code snippet i tried to show 5 blank rows in RadGrid.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnNeedDataSource
=
"RadGrid1_NeedDataSource"
CssClass
=
"grid"
>
<
MasterTableView
CommandItemDisplay
=
"None"
>
<
Columns
>
<
telerik:GridTemplateColumn
HeaderText
=
"Asset Name"
UniqueName
=
"AssetName"
>
<
ItemTemplate
>
<
asp:DropDownList
ID
=
"txtAssetName"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Asset No"
UniqueName
=
"AssetNo"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtAssetNo"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Description"
UniqueName
=
"AssetDescription"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtAssetDescription"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Class"
UniqueName
=
"AssetClass"
>
<
ItemTemplate
>
<
telerik:RadComboBox
ID
=
"rcbAssetClass"
runat
=
"server"
>
</
telerik:RadComboBox
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Useful Life"
UniqueName
=
"AssetUsefulLife"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtAssetUsefulLife"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"Original Value"
UniqueName
=
"AssetOriginalValue"
>
<
ItemTemplate
>
<
asp:TextBox
ID
=
"txtAssetOriginalValue"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
C#:
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
DataTable ds =
new
DataTable();
RadGrid1.DataSource = addBlankLines(ds,5);
}
private
DataTable addBlankLines(DataTable ds,
int
num)
{
int
count = 0;
if
(num != 0)
{
DataRow drBlank =
default
(DataRow);
for
(
int
i = 0; i <num; i++)
{
drBlank = ds.NewRow();
ds.Rows.Add(drBlank);
}
}
return
ds;
}
Please elaborate your scenario if this doesn't help.
Thanks,
Shinu.
0
Venkatesh
Top achievements
Rank 1
answered on 15 Jan 2013, 05:51 AM
Hi,
Thanks for the reply.
This is almost working. I can see in the datatable 5 rows being created while debugging, however in the UI it shows the empty datatemplate. In the MasterTableView, i have set EnableNoRecordsTemplate="false". But still see the no records template and not the 5 rows.
How to fix this?
Thanks for the reply.
This is almost working. I can see in the datatable 5 rows being created while debugging, however in the UI it shows the empty datatemplate. In the MasterTableView, i have set EnableNoRecordsTemplate="false". But still see the no records template and not the 5 rows.
How to fix this?
0
Sheetal
Top achievements
Rank 1
answered on 14 Oct 2013, 09:16 PM
Did you write:
RadGrid1.DataBind() in the end?
0
Hello Venkatesh,
Could you please provide your code declaration in order to investigate the issue locally? Note that if you are using advanced data binding it is not necessary to call DataBind() method.
Regards,
Kostadin
Telerik
Could you please provide your code declaration in order to investigate the issue locally? Note that if you are using advanced data binding it is not necessary to call DataBind() method.
Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.