One of the columns is the id of the loged in user.
This column is used in the SELECT command but I use Display="false" attribute in the GridBoundColumn tag so that it is not displayed.
How can I filter the results in the background so that I can see only the rows with a specific id?
I can get the id of the loged in user with this code :
myObject = Membership.GetUser();
string UserID = myObject.ProviderUserKey.ToString();
5 Answers, 1 is accepted
You can set the DataKeyNames as the UserId column(say column1) and then check if the UserId matches the DataKeyValues for the row and according show/hide rows. Check out the code below for a clear picture of the same.
Here's what I tried :
and I get the following error:
UserID is neither a DataColumn nor a DataRelation for table DefaultView
I forgot to change UserID with the column name I use in my database!
Thanx again for your help!
Is there any way to do the reverse thing?
What I mean is when a user adds a record his userid is added automatically to the record userid column.
Thank you very much for your immediate help!
Please check this article for more info how to provide default values for insert:
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.