| | |
Use variable from the code behind
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2007
Posts: 4
Reputation:
Solved Threads: 0
I am using this variable from the code behind :
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!
Reply
ASP.NET Syntax (Toggle Plain Text)
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!
Reply
•
•
Join Date: Jan 2008
Posts: 2,052
Reputation:
Solved Threads: 118
it seems ok, but if i were you, i would create a class for data access, and create 4 methods to select insert update and delete data, then use objectdatasource object to use those methods, so you dont have to bother with aspx and code behind thing. there is a good video tutorial on asp.net as to how to use objectdatasource efficiently.
Due to lack of freedom of speech, i no longer post on this website.
![]() |
Similar Threads
- how to input joystick in c++ to this code? (Game Development)
- session variable error (PHP)
- Variable pointers or References for .conf parser? (C++)
- loading a swf file using a variable (ColdFusion)
- calling session variable (ASP.NET)
- werid code bug (C++)
- assigning a string from a file to a variable (C++)
- How do i flush a variable (C)
Other Threads in the ASP.NET Forum
- Previous Thread: storing the doc file into sqlserver-2005
- Next Thread: Dynamically Adding User Controls at Runtime
| Thread Tools | Search this Thread |
.net activexcontrol advice ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox click commonfunctions control dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose fileuploader fill findcontrol flash form formatdecimal formview gridview gudi iframe iis javascript listbox login microsoft mono mouse mssql multistepregistration news novell numerical opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers






