is there a way to store field from a DataList?
Such as
string year = Eval("date");
I want to do manipulation on the string year, and need to store it in the variable if possible!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re using Eval, I’m guessing you’re doing work inside a databinding expression? If so, that’s generally the wrong place to do any actual post-processing of the data, but if you must do so, you should be able to explicitly cast like so:
Or, if the variable isn’t a string type natively,
Better yet, add a function to your page that accepts an object parameter and does the processing like so:
Then, in your ASP.NET page, whenever you’re doing the databinding…