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

[Solved] Allow update but not insert

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 10 Oct 2009, 03:16 AM
hi

How do i allow only update but not insert: Thanks

 

<telerik:GridTemplateColumn DataField="SellPrice"

 

DataType="System.Decimal" HeaderText="Sell Price"

 

SortExpression="SellPrice" UniqueName="SellPrice">

 

<EditItemTemplate>

 

 

<asp:TextBox ID="SellPriceTextBox" runat="server"

 

 

Text='<%# Bind("SellPrice") %>'></asp:TextBox>

 

 

 

</EditItemTemplate>

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="SellPriceLabel" runat="server"

 

 

 

Text='<%# Eval("SellPrice") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Oct 2009, 05:56 AM
Hello,

I tried following code snippet for disabling the TextBox when radgrid in insert mode. Give a try with this code.

C#:
 
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    if (e.Item.OwnerTableView.IsItemInserted && e.Item is GridEditFormInsertItem) 
    { 
        GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; 
        TextBox textBox = (TextBox)item.FindControl("SellPriceTextBox"); 
        textBox.Enabled = false;        
    } 

-Shinu.
0
L
Top achievements
Rank 1
answered on 12 Oct 2009, 11:35 AM
hi

I have tried but it still showing the textbox on insert. Thanks
0
L
Top achievements
Rank 1
answered on 12 Oct 2009, 12:53 PM
Thanks. It is working.
Tags
Grid
Asked by
L
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
L
Top achievements
Rank 1
Share this question
or