How to call a function from .aspx.cs file to .aspx file

Hi, U can use the .cs side function in .aspx side something below given method

I have created the following method in .cs side

public int GetNoOfForums(int groupId)
ForumCollection forums = new ForumCollection();
return forums.GetNoOfForums(groupId);

After that we call that method in  .aspx  something like below.

<asp:DataList ID=”dlstGroup” runat=”server” OnItemCommand=”dlstGroup_ItemCommand”
OnItemDataBound=”dlstGroup_ItemDataBound” >
<b>Created By</b>

<th style=”font-weight: bold;”>
No. of Forums
<td align=”left”>
<%#Eval(“CreatedByUserName”) %>
<td align=”left”>
<asp:Label ID=”lblStatus” runat=”server” Text=’ <%#Eval(“Status”) %>’></asp:Label>
<td align=”center”>



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s