This is a migrated thread and some comments may be shown as answers.

Editing RadGrid

5 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ashish
Top achievements
Rank 1
Ashish asked on 26 Jul 2010, 12:22 PM

 

 

<telerik:RadGrid runat="server" ID="grdDetails"

 

 

 

 

Skin="Vista" EnableAJAX="true" Height="100%" BorderWidth="0"

 

 

 

 

AllowSorting="true" Style="outline: none" ShowGroupPanel="true"

 

 

 

 

Width="100%" oncancelcommand="cancleGrdetails" oneditcommand="bindGrdetails1"

 

 

 

 

onupdatecommand="updategrdetails">

 

 

  

 

 

<MasterTableView AutoGenerateColumns="false" EditMode="PopUp">

 

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:GridBoundColumn UniqueName="Name" HeaderText="Name"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn UniqueName="EntityId" HeaderText="EntityId"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn UniqueName="Jurisdiction" HeaderText="Jurisdiction"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn UniqueName="EventType" HeaderText="EventType"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn UniqueName="StartDate" HeaderText="StartDate"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridBoundColumn UniqueName="EndDate" HeaderText="EndDate"></telerik:GridBoundColumn>

 

 

 

 

 

<telerik:GridEditCommandColumn HeaderText="Edit" UniqueName="Editrow"></telerik:GridEditCommandColumn>

 

 

 

 

 

</Columns>

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

<clientsettings>

 

 

 

 

 

<Selecting AllowRowSelect="true" />

 

 

 

 

 

</clientsettings>

 

 

 

 

</telerik:RadGrid>

 

 

 

 

 

protected void bindGrdetails(object sender, EventArgs e)

 

{

 

 

//grdDetails.DataSource = null;

 

 

grdDetails.DataSource =

 

 

"edit".Split();

 

 grdDetails.DataBind();

grdDetails.Visible =

 

true;

 

 

}

 

 

 

protected void bindGrdetails1(object source, GridCommandEventArgs e)

 

 {

grdDetails.Visible =

 

true;

 

 bindGrdetails(source, e);

  

}

 

 

 

protected void updategrdetails(object source, EventArgs e)

 

{

bindGrdetails(source, e);

}

 

 

 

protected void cancleGrdetails(object source, EventArgs e)

 

{

bindGrdetails(source, e);

}

 




In the above when i click on edit i get an error "Specified argument was out of the range of valid values"(In case of in place edit mode)

When edit mode is popup....the form fields are not editable...they are readonly......
I tried a lot but couldn't find the solution....

Ashish Gupta

5 Answers, 1 is accepted

Sort by
0
Kumar
Top achievements
Rank 1
answered on 26 Jul 2010, 02:23 PM
Hi Akash
I m not sure you have provided all the necessary information.
For Starters, there is no code to indicate the mode of edit.
That said, your server method code on update 'updategrdetails' seems to be missing condition
mode:(in place)
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
mode:(edit form)
    if (e.Item is GridEditableItem  && e.Item.IsInEditMode)  
mode:(pop-up form)
    If e.Item is GridEditFormItem && e.Item.IsInEditMode
Apply the appropriate condition and see if your problem is solved.

P.S. You could place the code within the provided placeholder accessible at the top of the form.
Copy pasted code in the text window is not easily readable and can be avoided.
thanks
Kumar.
0
Ashish
Top achievements
Rank 1
answered on 26 Jul 2010, 02:38 PM
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MonitoringControl.WebForm1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="DetailsView1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="grdDetails" LoadingPanelID="RadAjaxLoadingPanel1" />
                     <telerik:AjaxUpdatedControl ControlID="Lable1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
              
            <telerik:AjaxSetting AjaxControlID="AlertTreeView">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadToolBar1" />
                    <telerik:AjaxUpdatedControl ControlID="DetailsView1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
  
            
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="DetailsView1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="AlertTreeView" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
              
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1">
    </telerik:RadAjaxLoadingPanel>
      
    <telerik:RadTreeView runat="Server" ID="AlertTreeView" 
        Visible="false" onnodeclick="dataBind1"
        <Nodes>
            <telerik:RadTreeNode Text="Alerts" ImageUrl="Images/mailbox.gif" Expanded="true" Selected="false">
             <Nodes>
             <telerik:RadTreeNode Text="Active" ImageUrl="Images/inbox.gif">
             </telerik:RadTreeNode>
             </Nodes>
             <Nodes>
             <telerik:RadTreeNode Text="UnResolved" imageUrl="Images/inbox.gif">
             </telerik:RadTreeNode>
             </Nodes>
          </telerik:RadTreeNode>
        </Nodes>
        </telerik:RadTreeView>
  
        <telerik:RadTreeView runat="Server" ID="EventTreeView" 
        OnNodeClick="dataBind2"  Visible="true">
          
                <Nodes>
                    <telerik:RadTreeNode Text="Event" ImageUrl="Images/reply.gif" Expanded="true" Selected="false">
                        <Nodes>
                            <telerik:RadTreeNode Text="Active" ImageUrl="Images/inbox.gif">
                            </telerik:RadTreeNode>
                        </Nodes>
                        <Nodes>
                            <telerik:RadTreeNode Text="UnResolved" ImageUrl="Images/inbox.gif">
                                  
                            </telerik:RadTreeNode>
                        </Nodes>
                    </telerik:RadTreeNode>
                </Nodes>
              
    </telerik:RadTreeView>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
  
<telerik:RadSplitter runat="server" ID="RadSplitter1" Width="100%" BorderSize="0"
        BorderStyle="None" PanesBorderSize="0" Height="100%" Orientation="Horizontal">
        <telerik:RadPane runat="server" ID="RadPane1" Height="32px" EnableViewState="false"
            Scrollable="false">
            <telerik:RadToolBar runat="server" ID="ToolBar" CssClass="inbox-search-toolbar"
                EnableViewState="false" OnButtonClick="search">
                <Items>
                    <telerik:RadToolBarButton IsSeparator="true"  />
                    <telerik:RadToolBarButton Value="searchTextBoxButton">
                        <ItemTemplate>
                            <telerik:RadTextBox runat="server" ID="RadTextBox1" EmptyMessage="Search" Width="600px"
                                 />
                        </ItemTemplate>
                    </telerik:RadToolBarButton>
                    <telerik:RadToolBarButton ImageUrl="~/Images/search.gif" Value="search" />
                </Items>
            </telerik:RadToolBar>
        </telerik:RadPane>
        <telerik:RadPane runat="server" ID="RadPane2" Height="100%" Scrolling="X">
            <telerik:RadGrid runat="server" ID="RadGrid1"  GridLines="None" 
                AllowPaging="false" PageSize="4" 
            Skin="Vista"  EnableAJAX="true" Height="100%" BorderWidth="0" 
                AllowSorting="true" Style="outline: none" ShowGroupPanel="true" 
                onselectedindexchanged="bindGrdetails" >
                <MasterTableView TableLayout="Fixed" GroupLoadMode="Client" AutoGenerateColumns="false" >
                     
                      <Columns>
                       <telerik:GridBoundColumn UniqueName="Name"  HeaderText="Name"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="EntityId"  HeaderText="EntityId"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="Jurisdiction" HeaderText="Jurisdiction"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="EventType"  HeaderText="EventType"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="StartDate"  HeaderText="StartDate"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="EndDate"  HeaderText="EndDate"></telerik:GridBoundColumn>
                     </Columns>
                                              
                </MasterTableView>
                <clientsettings EnablePostBackOnRowClick="true">
                         <Selecting AllowRowSelect="true" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="true" />
                    </clientsettings>
            </telerik:RadGrid>
        </telerik:RadPane>
  
          
  
          <telerik:RadSplitBar runat="server" ID="RadSplitBar1" Height="107px" />
        <telerik:RadPane runat="server" ID="RadPane3" Height="100%" Width="100%">
                          
            <telerik:RadGrid runat="server" ID="grdDetails"  
            Skin="Vista"  EnableAJAX="true" Height="100%" BorderWidth="0" 
                AllowSorting="true" Style="outline: none" ShowGroupPanel="true" 
                Width="100%" oncancelcommand="cancleGrdetails" oneditcommand="bindGrdetails1" 
                onupdatecommand="updategrdetails">
                <MasterTableView  AutoGenerateColumns="false" EditMode="PopUp">
                    <Columns>
                       <telerik:GridBoundColumn UniqueName="Name"  HeaderText="Name"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="EntityId"  HeaderText="EntityId"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="Jurisdiction"  HeaderText="Jurisdiction"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="EventType"  HeaderText="EventType"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="StartDate"  HeaderText="StartDate"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn UniqueName="EndDate"  HeaderText="EndDate"></telerik:GridBoundColumn>
                        <telerik:GridEditCommandColumn HeaderText="Edit" UniqueName="Editrow"></telerik:GridEditCommandColumn>
                          
                    </Columns>
                    <EditFormSettings>
                        <PopUpSettings Modal="true" />
                         
                    </EditFormSettings>
  
                      
                    </MasterTableView>
  
                <clientsettings>
                    <Selecting AllowRowSelect="true" />
                      
                 </clientsettings>
  
            </telerik:RadGrid>
              
        </telerik:RadPane>
     </telerik:RadSplitter>
</asp:Content>
protected void dataBind1(object sender, RadTreeNodeEventArgs e)
        {
            if (AlertTreeView.FindNodeByText("UnResolved").Selected == true)
            {
                RadGrid1.DataSource = "Alert UnResolved Alert UnResolved".Split();
                RadGrid1.DataBind();
                AlertTreeView.Visible = true;
            }
            else if (AlertTreeView.FindNodeByText("Active").Selected == true)
            {
                RadGrid1.DataSource = "Alert Active Alert Active".Split();
                RadGrid1.DataBind();
                AlertTreeView.Visible = true;
            }
  
            else
            {
                RadGrid1.DataSource = null;
                RadGrid1.DataBind();
                RadGrid1.Visible = false;
  
            }
        }
  
        protected void dataBind2(object sender, RadTreeNodeEventArgs e)
        {
            if (EventTreeView.FindNodeByText("Active").Selected == true)
            {
                RadGrid1.DataSource = "Event Active Event Active Active Active".Split();
                RadGrid1.DataBind();
                EventTreeView.Visible = true;
  
            }
            else if (EventTreeView.FindNodeByText("UnResolved").Selected == true)
            {
                RadGrid1.DataSource = "Event UnResolved Event UnResolved".Split();
                RadGrid1.DataBind();
                EventTreeView.Visible = true;
            }
            else
            {
                RadGrid1.DataSource = null;
                RadGrid1.DataBind();
                RadGrid1.Visible = false;
  
            }
        }
  
        protected void bindGrdetails(object sender, EventArgs e)
        {
              
            //grdDetails.DataSource = null;
            grdDetails.DataSource = "edit".Split();
            grdDetails.DataBind();
            grdDetails.Visible = true;
  
        }
  
          
  
        protected void bindGrdetails1(object source, GridCommandEventArgs e)
        {
            grdDetails.Visible = true;
             
            bindGrdetails(source, e);
              
             
              
   }
0
Ashish
Top achievements
Rank 1
answered on 26 Jul 2010, 02:42 PM
Now issue is..My popup form is not in edit mode.......When i click on edit bindGrdetails1 is being called but the popup form i get is not editable....
Ashish
0
Iana Tsolova
Telerik team
answered on 29 Jul 2010, 12:08 PM
Hi Ashish,

Could you please try opening a formal support ticket and send us a runnable version of your scenario there? We will check it out and turn back to you with our findings.

Kind regards,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ashish
Top achievements
Rank 1
answered on 29 Jul 2010, 12:12 PM
Hey...Thanks a lot...But today i resolved the issue........
 i was not providing datafields to the columns thats why i had problem.
Tags
Grid
Asked by
Ashish
Top achievements
Rank 1
Answers by
Kumar
Top achievements
Rank 1
Ashish
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or