Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:26:00+00:00 2026-06-13T23:26:00+00:00

I have an eval in an aspx page that has an eval in the

  • 0

I have an eval in an aspx page that has an eval in the template of a gridview. My problem is that that eval calls a method with parameters that are object. Can I change the method to accept the proper parameters and use cast with the eval stament.

I need something like this:

<%# MyClas.MyMethod((string)Eval("Param1"),(int)Eval("Param2"), (string)Eval("Param3"))%>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:26:00+00:00Added an answer on June 13, 2026 at 11:26 pm

    You could create your signature to contain the right types or type object. This is entirely dependent on the data and your preference. If any of your parameters return NULL, there may be an exception with the casting of your evaluated data item. I personally prefer the first option, but then I always ensure that there will not be a null in the result set.

    Option 1:

    <%# MyClas.MyMethod((string)Eval("Param1"),(int)Eval("Param2"), (string)Eval("Param3"))%>
    

    Code:

    public string MyMethod(string param1, int param2, string param3) {
        return "";
    }
    

    or Option 2:

    <%# MyClas.MyMethod(Eval("Param1"),Eval("Param2"), Eval("Param3"))%>
    

    Code:

    public string MyMethod(object param1, object param2, object param3) {
        return "";
    }
    

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my first load of my aspx page, I have a GridView that are
I have an UpdatePanel in my default.aspx page and the UpdatePanel has asp placeholder,
In my aspx page I have a gridview which displays the value from my
I have an aspx page that makes an Ajax request (using jquery) to a
I have an aspx page which contains a repeater. I can output data using
C# or VB.NET are welcome. I have an <%#Eval(FirstName)%> in the aspx page, I
I have a ListView on a page that uses a object data source. I
I have an ascx that uses Eval in a repeater like this: <%@ Control
In my .aspx page I have my DataList: <asp:DataList ID=DataList1 runat=server DataKeyField=ProductSID DataSourceID=SqlDataSource1 onitemcreated=DataList1_ItemCreated
i've the following code in aspx page <asp:Label ID=CittaLabel runat=server Text='<%# Eval(Citta) %>' Font-Size='<%#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.