Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Please help me, I have code <%# Eval("Title").ToString()%> on my aspx control page.

I want to pass this value to my aspx.cs page.

So that i can write the c# functions please help me.


Rajkumar Pasi
Posted
Updated 12-Nov-11 19:31pm
v2

The code you have gets the value from the database.
You can use a datareader or dataset to get the value and use in .cs file.
For example if you have used a repeater control then in ItemCommand event or ItemDataBound event you can get that value something like

C#
string title=DataBinder.Eval(e.Item.DataItem,"Title").ToString();
 
Share this answer
 
Comments
thatraja 13-Nov-11 3:36am    
Spot on, 5!
 
Share this answer
 
Comments
m@dhu 13-Nov-11 2:02am    
OP has not asked to pass the values between web pages. :)
As I understood your question you want to pass the result of Eval("Title").ToString() to a function to do further processing. So add a public function which receives a string and returns a string to your page :

C#
public string mr(string s)
{
    return "Mr." + s;
}


and change your inline code to this :
<br />
<%#mr(Eval("Title").ToString())%><br />


Hope It Helps.
 
Share this answer
 
v3

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