declare grid
create edit form in itemreated event and insert dynamic control to placeholder1 in editform
works great for editting. Now how do i allow this to be able to click on the "Add New Recod" at the command tool bar to access the form to the insert command? Can somebody help me with this please? Thank you and really appreciate it.
<telerik:RadGrid ID="RadGrid1" runat="server" Skin="txstate" EnableEmbeddedSkins="false" Width="600px" Visible="false" > <MasterTableView Width="100%" DataKeyNames="ID" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Add New" CommandItemSettings-ShowAddNewRecordButton="true" CommandItemSettings-ShowRefreshButton="false"> <PagerStyle Mode="NextPrevAndNumeric" /> <Columns> <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="LinkButton" EditText="Edit" /> <telerik:GridButtonColumn UniqueName="InsertColumn" CommandName="Add" Text="Add" ButtonType="LinkButton" /> <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName= "DeleteColumn" /> </Columns> <EditFormSettings EditFormType="Template"> <FormTemplate> <asp:PlaceHolder ID="PlaceHolder1" runat="server" /> </FormTemplate> </EditFormSettings> </MasterTableView> </telerik:RadGrid>create edit form in itemreated event and insert dynamic control to placeholder1 in editform
Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs) Handles RadGrid1.ItemCreated If TypeOf e.Item Is GridEditFormItem And e.Item.IsInEditMode Then Dim editItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem) Dim PlaceHolder1 As PlaceHolder = DirectCast(editItem.FindControl("PlaceHolder1"), PlaceHolder) PlaceHolder1.Controls.Add(New LiteralControl("<table border='0' cellpadding='5' cellspacing='0' width='100%' align='center'><tr><td width='110px'>")) Dim lb_Description As Label = New Label lb_Description.Text = "Description: " lb_Description.ID = "lb_Description" lb_Description.CssClass = "label" PlaceHolder1.Controls.Add(lb_Description) Dim txt_Description As RadTextBox = New RadTextBox
txt_Description.Text = editItem.Item("Description").Text
txt_Description.ID = "txt_Description"
txt_Description.Width = "200"
PlaceHolder1.Controls.Add(txt_Description)
Dim btn_update As Button = New Button
btn_update.Text = "Update"
btn_update.ID = "btn_Update"
btn_update.CommandName = "Update"
btn_update.CssClass = "button"
PlaceHolder1.Controls.Add(btn_update)
Dim btn_cancel As Button = New Button
btn_cancel.Text = "Cancel"
btn_cancel.ID = "btn_cancel"
btn_cancel.CommandName = "Cancel"
btn_cancel.CssClass = "button"
PlaceHolder1.Controls.Add(btn_cancel)
End If
End Subworks great for editting. Now how do i allow this to be able to click on the "Add New Recod" at the command tool bar to access the form to the insert command? Can somebody help me with this please? Thank you and really appreciate it.