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

Use variable from the code behind

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stavros
Top achievements
Rank 1
Stavros asked on 26 Nov 2008, 09:23 AM
I am using this variable from the code behind :




public string UserID; //globally declare the UserId
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
MembershipUser myObject = Membership.GetUser();
UserID = myObject.ProviderUserKey.ToString();
}

I am trying to use the variable in the INSERT command in the aspx file but it seems that the following command does not work,any ideas why?

InsertCommand="INSERT INTO table (column1, column2) VALUES (value1, '<%=UserID %>')"


Thanks!

1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 26 Nov 2008, 11:56 AM
Hello Stavros,

You should attach event handler for this grid event.

Kind regards,
Vlad
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
Vlad
Telerik team
Share this question
or