1

I'm using the following code to try to display a series of textareas using but no data is being displayed.

I have written the following:

string rolesString = dr["TheRole"].ToString().TrimEnd(';');
            List<string> rolesList = new List<string>(rolesString.Split(';'));
            uxRolesList.DataSource = rolesList;
            uxRolesList.DataBind();

Where rolesString should look something like this:

rolesString = "Test 1; Test 2; Test 3";

And also:

<asp:Repeater ID="uxRolesList" runat="server">
     <ItemTemplate>
           <asp:TextBox ID="uxTxtBoxRole" runat="server" rows="5" columns="100" 
                TextMode="multiline"></asp:TextBox>
                    <br /><br />
     </ItemTemplate>
</asp:Repeater>

But all I get is a series of textareas with no data in them. I'm very new to asp.net and c# so please be gentle ;)

शेखर
  • 17,412
  • 13
  • 61
  • 117
Gemma Church
  • 63
  • 1
  • 11

1 Answers1

1

use this in the text <%# Container.DataItem %> like below

<asp:TextBox ID="uxTxtBoxRole" runat="server" Text='<%# Container.DataItem %>' 
     columns="100"  rows="5" TextMode="multiline"></asp:TextBox>

More Details
ASP.NET Repeater bind List<string>

Community
  • 1
  • 1
शेखर
  • 17,412
  • 13
  • 61
  • 117