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

RadGrid EditForm problem

9 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan McAlister
Top achievements
Rank 1
Dan McAlister asked on 31 Oct 2008, 02:40 PM
Hello,

I am having an issue getting the edittform to show up.  I have pasted in my code for the grid.

<

rad:RadGrid ID="rgAccountClass" runat="server"

 

 

onneeddatasource="rgAccountClass_NeedDataSource"

 

 

AllowAutomaticUpdates="True"

 

 

AutoGenerateColumns="false" EnableLinqExpressions="false"

 

 

AllowPaging="true" Skin="Default2006">

 

 

<PagerStyle Mode="Slider" />

 

 

<ClientSettings>

 

 

<Selecting AllowRowSelect="true" />

 

 

</ClientSettings>

 

 

<MasterTableView EditMode="EditForms">

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px"></HeaderStyle>

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

 

<rad:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommand" EditImageUrl="Skins/Default2006/Grid/Edit.gif" />

 

 

<rad:GridBoundColumn UniqueName="AccountClassCode" DataField="AccountClassCode" HeaderText="Account Class" />

 

 

<rad:GridBoundColumn UniqueName="Description" DataField="Description" HeaderText="Description" />

 

 

 

<rad:GridTemplateColumn UniqueName="CycleBFlag2" EditFormColumnIndex="0">

 

 

<EditItemTemplate>

 

 

<asp:TextBox ID="txtTest" runat="server" />

 

 

</EditItemTemplate>

 

 

<ItemTemplate>

 

 

<asp:Label ID="lblCycleBFlag" runat="server" Text='<%# Bind("CycleBFlag") %>' />

 

 

</ItemTemplate>

 

 

</rad:GridTemplateColumn>

 

 

 

<rad:GridBoundColumn UniqueName="CycleBFlag" DataField="CycleBFlag" HeaderText="Cycle B Flag" />

 

 

<rad:GridBoundColumn UniqueName="ModifiedBy" DataField="ModifiedBy" HeaderText="Modified By" />

 

 

<rad:GridBoundColumn UniqueName="ModifiedDate" DataField="ModifiedDate" HeaderText="Modified Date" />

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

<FilterMenu EnableTheming="True">

 

 

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

 

 

</FilterMenu>

 

 

</rad:RadGrid>

I have tried several different ways to make this work and nothing seems to be right.  I amsure I Am missing something simple.  Any help would be appreciated.

Thanks, Dan

 

9 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 31 Oct 2008, 03:52 PM
Hello Dan,

I created a simple example based on your code. You can find it attached to this thread.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dan McAlister
Top achievements
Rank 1
answered on 31 Oct 2008, 04:13 PM
Daniel,

Thanks for the example.  I was actually trying to use a edittemplate but was having no success adding the editbutton column to initiate the template.

Thanks, Dan
0
Daniel
Telerik team
answered on 31 Oct 2008, 04:27 PM
Hello Dan,

I attached another example illustrating a possible approach for EditTemplate.

You can create Edit button using GridButtonColumn, GridTemplateColumn or AutoGeneratedEditColumn.

- Auto generated Edit column:
<telerik:RadGrid ID="RadGrid1" AutoGenerateEditColumn="true" 

- GridButtonColumn
<telerik:GridButtonColumn CommandName="Edit" Text="Edit" UniqueName="myEditColumn"
</telerik:GridButtonColumn> 

- GridTemplateColumn
<telerik:GridTemplateColumn> 
    <ItemTemplate> 
        <asp:Button ID="myEditButton" runat="server" CommandName="Edit" Text="Edit" /> 
    </ItemTemplate> 
</telerik:GridTemplateColumn> 

I hope this helps.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dan McAlister
Top achievements
Rank 1
answered on 31 Oct 2008, 05:31 PM
Hello,

This code use to work.  I have other projects set up similar to this.  I am using the new RadGrid AJAX Q2_2008_826 files and the 3.5 version and I cannot seem to make htis work using this control.

Thanks, Dan




0
Daniel
Telerik team
answered on 03 Nov 2008, 02:36 PM
Hello Dan,

Could you please elaborate a bit on the problems you faced? This may help us to provide more to-the-point answer.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dan McAlister
Top achievements
Rank 1
answered on 03 Nov 2008, 02:45 PM
Hello,

The simplest way I can put is I have a grideditcommandcolumn in my grid and I have a formtemplate to us ein edit mode.

When I run my page and click the edit button.  Nothing happens.  The edit form does not appear.

Thanks, Dan
0
Dan McAlister
Top achievements
Rank 1
answered on 03 Nov 2008, 03:18 PM
Hello,

I found the problem.  I have this in my columns section:

<

rad:GridEditCommandColumn ButtonType="ImageButton"></rad:GridEditCommandColumn>

When you run the page and click the button nothing happens.  When I remove the buttontype:

 

<

rad:GridEditCommandColumn></rad:GridEditCommandColumn>

It works and my editgrid shows up.

Thanks, Dan

 

0
Nishanth
Top achievements
Rank 1
answered on 07 Jun 2011, 09:21 PM
Hi, 

I am facing the same problem. When I convert the GridEditCommandColumn to ImageButton type, the edit is not happening. Only a post back happens. Here is the code that I am using :

  protected void grdQueue_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
        {
            GridColumn col = (GridColumn)e.Column;
            if (col.UniqueName == "AutoGeneratedEditColumn")
            {
                GridEditCommandColumn editCol = (GridEditCommandColumn)e.Column;
                editCol.HeaderText = "Resend Fax";
                editCol.UpdateImageUrl = "~/Content/Images/CheckMark.png";
               //problem is here with the below line. if i remove this line, edit works.
                editCol.ButtonType = GridButtonColumnType.ImageButton;
                
                editCol.UpdateText = "Send";
                editCol.EditText = "Resend";
                editCol.EditImageUrl = "~/Content/Images/Icons/Fax_Small.png";


                editCol.CancelText = "Cancel";
                editCol.CancelImageUrl = "~/Content/Images/Icons/icon_vh_closeLarge.png";
            }
        }

  Problem is  with the below line. if i remove this line, edit works but a normal link will be shown.
                editCol.ButtonType = GridButtonColumnType.ImageButton; 

how can I change the autogenerated edit buttons so that i display images instead of a normal link ? 

Thanks,
Nishanth
0
Princy
Top achievements
Rank 2
answered on 08 Jun 2011, 11:36 AM
Hello Nishanth,

I tried the same scenario and it is working as expected in my end. Here am pasting the code that I tried. Please elaborate your scenario if it doesn't help.

C#:
protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
   {
       if (e.Column.UniqueName == "AutoGeneratedEditColumn")
       {
           GridEditCommandColumn editcol = (GridEditCommandColumn)e.Column;
           editcol.ButtonType = GridButtonColumnType.ImageButton;
           editcol.HeaderText = "editme";
           editcol.UpdateText = "Send";
           editcol.EditText = "Resend";
           editcol.EditImageUrl = "~/Content/Images/Icons/Fax_Small.png";
           editcol.CancelText = "Cancel";
           editcol.CancelImageUrl = "~/Content/Images/Icons/icon_vh_closeLarge.png";
       }
   }

Thanks,
Princy.
Tags
Grid
Asked by
Dan McAlister
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Dan McAlister
Top achievements
Rank 1
Nishanth
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or