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

Radgrid DefaultInsertValue

3 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 28 Sep 2011, 09:24 AM
I am using the inline, Edit/Update/Delete
Is it possible to insert a variable using the DefaultInsertValue.

For E.g I have a hidden Field which I am storing an ID in and on an Insert I which to use the value from the hidden field as the defaultinsertvalue. Is this possible?

Perhaps I am going about it the wrong way.
Any assistance would be appreciated.
Thanks.

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Sep 2011, 09:48 AM
Hello,

protected void ModifiedContentsReportGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem  item = e.Item as GridEditFormItem ;
            TextBox TextBox1 = item.FindControl("TextBox") as TextBox;
            HiddenField HiddenField1 = item.FindControl("HiddenField1") as HiddenField; // if your hidden field inside grid
            if (string.IsNullOrEmpty(TextBox1.Text))
            {
                TextBox1.Text = HiddenField1.Value;
            }
        }
    }


Thanks,
Jayesh Goyani
0
Derek
Top achievements
Rank 1
answered on 28 Sep 2011, 10:16 AM
Hi Jayesh,

Thanks for the response, I'm quite new to programming would you be able to do that in vb.net if possible.

Thanks


Not to Worry I've worked it out. Thanks
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Sep 2011, 11:20 AM
Hello,

Sorry for late reply.

You can convert code from below link.

http://converter.telerik.com/
http://www.developerfusion.com/tools/convert/csharp-to-vb/

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Derek
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Derek
Top achievements
Rank 1
Share this question
or