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

  • Home
  • SEARCH
  • 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 481453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:59:46+00:00 2026-05-13T00:59:46+00:00

Say I have this repeater which makes use of a public function called Test

  • 0

Say I have this repeater which makes use of a public function called Test in the code-behind.

<asp:Repeater  ID="Repeater1" runat="server">
<HeaderTemplate>
  <table>
</HeaderTemplate>

<ItemTemplate>
  <tr>
     <td><%# Eval("MyCol1")%></td>
     <td><%# Eval("MyCol2")%></td>
     <td><%# Test((int)Eval("MyCol1"))%></td>
  </tr>
</ItemTemplate>

<FooterTemplate>
  </table>
</FooterTemplate>
</asp:Repeater>

In my code-behind, I have this function

public string Test (int Value)
{
   return "Test"+Value.ToString();
}

This works fine but in my website I will have similar repeaters on various pages and most of them will need to call the Test function. Instead of having it in the code-behind of each web page would it be possible to put it in a public static class and call it directly from the repeater? Something like this (which does not work):

<td><%# MyStaticClass.Test((int)Eval("MyCol1"))%></td>

The only solution I’ve come up with would be to change the function in the code-behind to:

public string Test (int Value)
{
   return MyStaticClass.Test(Value);
}

But it would be neater if I didn’t have to put any code in the code-behind of each webpage (ie I would prefer the repeater to call the static function directly).

Any ideas or suggestions?

  • 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-05-13T00:59:46+00:00Added an answer on May 13, 2026 at 12:59 am

    Create a Base class for your pages and put your common function there. So it will be available for all inherited child pages.

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

Sidebar

Related Questions

Say i have a data structure like this: type Foo struct { Bar []struct
I have a huge list of mp3 files, the names of which I want
Hi lets say I've got this array: $check_post = array( $_POST[a_post], $_POST[b_post], $_POST[c_post], $_POST[d_post],
I have a DataTable with 10 rows say one of the columns numbered 1
I'm writing a formbuilder for our CMS which dynamically loads bespoke controls into panels
I'm not sure how to better phrase this question so it's possible I missed
Basically, I have a form that generates a certain number of types of publications
Take an example of a question/answer site with a 'browse' slideshow that will show
I'm trying to make a decision about how to display my data. What I
I am looking for a way to make speedy modifications to large multi-gigabyte files.

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.