Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am beginner in this so i want to know how to pass a value from .aspx.cs page to .aspx page

the reason is i want to display the primary key column in the gridview .
i don't know the database and table i am selecting the database and table through dropdownlist so i want to pass the primary key column to the
C#
Eval("here")
. i am determined primary key column through query so please tell me how can i pass that to aspx page this please....
Posted
Updated 3-Jan-13 0:32am
v2

You can use hidden field. Set value is your cs code .

e.g



You can access it in cs file as
Request.Form["hiddenfield1"];
 
Share this answer
 
Comments
Member 9644686 3-Jan-13 7:07am    
send some code snippets regarding hidden field please...
Create a property in you cs page and bind that property in that eval tag.

Now set the column name to that property.

The property should be a string.

[Update]

Whenever you fetch query alias all primary key filed as ID

now
C#
Eval("ID")
 
Share this answer
 
v2
Comments
Member 9644686 3-Jan-13 6:47am    
i am doing like this but i can't get
assume primary_key_column= Empid.

in cs page
got the primary_key_column as Empid

in aspx page i am written like this

<%# Eval("<%=primary_key_column%>") %>

but i am getting a error
Suvabrata Roy 3-Jan-13 6:48am    
What error
Member 9644686 3-Jan-13 7:01am    
Error means that primary_key_column is display in gridview.
Member 9644686 3-Jan-13 7:05am    
Coompilation error
Suvabrata Roy 3-Jan-13 7:14am    
Refer to update block

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900