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

How to remove a field from the edit form

8 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stavros
Top achievements
Rank 1
Stavros asked on 21 Nov 2008, 12:02 PM
I have an invisible field (<telerik:GridBoundColumn .... Visible="false") in my grid.
When I use the edit button that field appear in the edit form.
Is there any way to make it dissapear from the edit form?
Thank you!

8 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Nov 2008, 12:30 PM
Hello Stavros,

Please test the attached example and let us know if you need further assistance.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Stavros
Top achievements
Rank 1
answered on 21 Nov 2008, 01:14 PM
I can't make it dissapear.
The only difference that I have from your code is that I have AutoGenerateColumns="False"

Here's my tag :

<

 

telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="False" AllowFilteringByColumn="True"

 

 

AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource5"

 

 

GridLines="None" PageSize="30" ShowGroupPanel="True" Skin="Telerik" ShowStatusBar="True"

 

 

Width="100%" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"

 

 

AllowAutomaticUpdates="True" OnPreRender="RadGrid2_PreRender"

 

 

EnableLinqExpressions="False" AutoGenerateEditColumn="True"

 

 

onitemcommand="RadGrid2_ItemCommand">

 

0
Princy
Top achievements
Rank 2
answered on 21 Nov 2008, 01:38 PM
Hello Stavros,

A suggestion would be to use a FormTemplate EditForm which mimics the AutoGeneratedEditForm excluding the column you woukld require to hide.

Thanks
Princy.
0
Stavros
Top achievements
Rank 1
answered on 21 Nov 2008, 01:45 PM
I know of the alternatives.
I could also use EditMode="InPlace"
The question is if I can do it in edit form mode.

I have another problem too.
How can I add an insert button?
Thank you!
0
Stavros
Top achievements
Rank 1
answered on 21 Nov 2008, 02:23 PM
I solved the insert button problem using 

CommandItemDisplay

 

="TopAndBottom"

in the MastertableView tag.

 

0
SamJ
Top achievements
Rank 1
answered on 22 Nov 2008, 12:01 PM
Hi Stavros,

Try setting the ReadOnly property of this GridBoundColumn to true. I think this can help.


0
Stavros
Top achievements
Rank 1
answered on 24 Nov 2008, 09:24 AM

It worked!
The only thing I have not managed to do yet is to program properly the insert record form.
There is a building_id column that is identity field in the database so the user should not be able to insert a number in it because the database add a number automatically.
I also want to code the insert form so that it enters automatically the customer_id in the hidden column.

I get this id in the page code behind file with the following code :

 

string UserID; //globally declare the UserId   
    protected void RadGrid1_PreRender(object sender, EventArgs e)  
    {  
        MembershipUser myObject = Membership.GetUser();  
        UserID = myObject.ProviderUserKey.ToString();  
    } 
0
Daniel
Telerik team
answered on 24 Nov 2008, 01:32 PM
Hello Stavros,

I modified the previous example to illustrate the needed functionality.

Some notes:
CategoryID is auto-generated by the database (read-only)
CategoryName is modified in code-behind (read-only)
Description is editable by the user

Hope this helps.

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Stavros
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Stavros
Top achievements
Rank 1
Princy
Top achievements
Rank 2
SamJ
Top achievements
Rank 1
Share this question
or