Click here to Skip to main content
14,304,285 members
Rate this:
Please Sign up or sign in to vote.
See more:
i required string length to use in aspx page using for loop. This string length will be calculate the database values count from code behind and that value will be retrieved to aspx page for for loop condition. how to achieve this please anybody give me suggestion. But i am getting error saying: The name 'count' does not exist in the current context.

What I have tried:

<asp:UpdatePanel ID="upQuestionsAndChoiceTabPanel" runat="server">
        <cc1:TabContainer ID="OnlineTestTab" runat="server" AutoPostBack="true" ActiveTabIndex="1">
            <% for (int i = 0; i < count.Length; i++)
            { %>
            <%} %>

In code behind:
public string count;
This count will bind data from database in page_load event. That count length i require anybody please help me
Updated 22-Dec-18 10:21am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Read that editor value in a string variable and then you can find the count using string.Length property.

string test="Code Project";
int count=test.Length;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100