4 Answers, 1 is accepted
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Sep 2010, 05:18 AM
Hello Fred,
The following code snippet will be of help in opening the insert form when page loads.
Code:
-Shinu.
The following code snippet will be of help in opening the insert form when page loads.
Code:
protected void RadGrid1_PreRender(object sender, EventArgs e) { RadGrid1.MasterTableView.IsItemInserted = true; RadGrid1.MasterTableView.Rebind(); }-Shinu.
0
Fred
Top achievements
Rank 1
answered on 21 Sep 2010, 03:53 PM
Thank you!
0
Aaron
Top achievements
Rank 2
answered on 20 Oct 2010, 10:13 PM
I'm doing the same thing, in my ItemCommand event, in my case i created a button column wich provides a unique command name, in this case "Printers", so, in my event, i evaluate the command name, and whenever its "Printers", i change my mastertable's usercontrol, and change it, and then open the pop up, but when trying to use eval, to retreive the current id, i get a blank string, but when i do this, using the edit column, and sending as command name "Edit", i get to retreive the data
and i'm doing the databind like this
and this is the radgrid's code
protected void rgStations_ItemCommand(object source, GridCommandEventArgs e) { switch (e.CommandName) { case "InitInsert": rgStations.MasterTableView.EditFormSettings.UserControlName = "~/UserControls/AddStations.ascx"; break; case "Edit": rgStations.MasterTableView.EditFormSettings.UserControlName = "~/UserControls/EditStations.ascx"; break; case "Printers": rgStations.MasterTableView.EditFormSettings.UserControlName = "~/UserControls/StationsPrinters.ascx"; rgStations.MasterTableView.IsItemInserted = true; //rgStations.MasterTableView.Rebind(); break; } ObtenerEstaciones();//this is the method i use to retreive my data for the grid }and i'm doing the databind like this
<asp:TextBox ID="txtSelectedStationValue" runat="server" Text='<%# Eval("Id") %>'></asp:TextBox>and this is the radgrid's code
<telerik:RadGrid ID="rgStations" runat="server" Skin="Black" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" onitemcommand="rgStations_ItemCommand" > <MasterTableView CommandItemDisplay="Top" EditMode="PopUp"> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="Id" HeaderText="Station Name" UniqueName="NameColumn"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Description" HeaderText="Description" UniqueName="DescriptionColumn"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Line" HeaderText="Line" UniqueName="LineColumn"> </telerik:GridBoundColumn> <telerik:GridCheckBoxColumn DataField="IsMirror" DataType="System.Boolean" HeaderText="Is Mirror" UniqueName="IsMirrorColumn"> </telerik:GridCheckBoxColumn> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Printers" HeaderText="Printers" ImageUrl="~/Resources/Icon_printers.png" UniqueName="PrintersColumn"> <HeaderStyle HorizontalAlign="Center" /> <ItemStyle HorizontalAlign="Center" /> </telerik:GridButtonColumn> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" HeaderText="Edit" ImageUrl="~/Resources/Icon_edit.gif" UniqueName="EditColumn"> </telerik:GridButtonColumn> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Are you sure you want to delete this row?" ConfirmTitle="Warning" HeaderText="Delete" ImageUrl="~/Resources/Icon_delete.gif" UniqueName="DeleteColumn"> </telerik:GridButtonColumn> </Columns> <EditFormSettings EditFormType="WebUserControl" UserControlName="~/UserControls/EditStations.ascx"> <PopUpSettings Modal="True" Height="300px" /> </EditFormSettings> </MasterTableView> <ClientSettings> <ClientEvents OnPopUpShowing="PopUpShowing" /> <Selecting AllowRowSelect="True" /> </ClientSettings> </telerik:RadGrid>0
Aaron
Top achievements
Rank 2
answered on 20 Oct 2010, 10:39 PM
Sorry, my bad, i just solved it, i just enabled the edit mode, and that was it
case "Printers": e.Item.Edit = true; rgStations.MasterTableView.EditFormSettings.UserControlName = "~/UserControls/StationsPrinters.ascx"; rgStations.MasterTableView.IsItemInserted = true; //rgStations.MasterTableView.Rebind(); break;