Hello,
I want to make a simple grid on my website, allowing the users to input some data in the grid, but I find the demos are a little bit complicate, is there some samples that can fulfill:
- Creating a grid of several columns with known headings (and its data format)
- No need to connect to the database (No data binding, 0 rows when page load)
- Allow users to add/remove/edit rows
- Can get the input data for calculation when some button is clicked
I know it is a very simple problem, but I cannot find some demos without data binding.
------------------------------------------ Update ------------------------------------------
My current code:
It can show a empty grid when page load, but when I press the "add new record" button, it do not go into the event.
Regards,
Kev
I want to make a simple grid on my website, allowing the users to input some data in the grid, but I find the demos are a little bit complicate, is there some samples that can fulfill:
- Creating a grid of several columns with known headings (and its data format)
- No need to connect to the database (No data binding, 0 rows when page load)
- Allow users to add/remove/edit rows
- Can get the input data for calculation when some button is clicked
I know it is a very simple problem, but I cannot find some demos without data binding.
------------------------------------------ Update ------------------------------------------
My current code:
<telerik:RadAjaxPanel ID=
"RadAjaxPanel1"
runat=
"server"
LoadingPanelID=
"RadAjaxLoadingPanel1"
>
<telerik:RadGrid ID=
"RadGrid1"
runat=
"server"
AllowPaging=
"true"
AllowSorting=
"true"
OnDeleteCommand=
"RadGrid1_DeleteCommand"
OnInsertCommand=
"RadGrid1_InsertCommand"
AllowFilteringByColumn=
"false"
OnUpdateCommand=
"RadGrid1_UpdateCommand"
OnUnload=
"RadGrid1_Unload"
>
<MasterTableView CommandItemDisplay=
"Top"
AutoGenerateColumns=
"false"
DataKeyNames=
"Field1"
InsertItemPageIndexAction=
"ShowItemOnCurrentPage"
>
<Columns>
<telerik:GridEditCommandColumn ButtonType=
"ImageButton"
/>
<telerik:GridButtonColumn ConfirmText=
"Delete this object?"
ConfirmDialogType=
"RadWindow"
ConfirmTitle=
"Delete"
ButtonType=
"ImageButton"
CommandName=
"Delete"
ConfirmDialogHeight=
"100px"
ConfirmDialogWidth=
"220px"
/>
<telerik:GridBoundColumn DataField=
"Field1"
HeaderText=
"Field One"
UniqueName=
"Field1"
DataType=
"System.String"
/>
<telerik:GridBoundColumn DataField=
"Field2"
HeaderText=
"Field Two"
UniqueName=
"Field2"
DataType=
"System.Double"
/>
<telerik:GridBoundColumn DataField=
"Field3"
HeaderText=
"Field Three"
UniqueName=
"Field3"
DataType=
"System.String"
/>
<telerik:GridBoundColumn DataField=
"Field4"
HeaderText=
"Field Four"
UniqueName=
"Field4"
DataType=
"System.DateTime"
/>
</Columns>
</MasterTableView>
<ClientSettings>
<DataBinding Location=
"WebService.asmx"
SelectMethod=
"GetDataAndCount"
/>
</ClientSettings>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
protected
void
Page_Load(
object
sender, EventArgs e)
{
// ...
if
(!Page.IsPostBack)
{
RadGrid1.DataSource =
new
Object[0];
}
}
protected
void
RadGrid1_UpdateCommand(
object
sender, GridCommandEventArgs e)
{
// Something
}
protected
void
RadGrid1_InsertCommand(
object
sender, GridCommandEventArgs e)
{
// Something
}
protected
void
RadGrid1_DeleteCommand(
object
sender, GridCommandEventArgs e)
{
// Something
}
protected
void
RadGrid1_Unload(
object
sender, EventArgs e)
{
// Something
}
It can show a empty grid when page load, but when I press the "add new record" button, it do not go into the event.
Regards,
Kev