CheckBocList values problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi....I have a problem.

I created a CheckBoxList on a web form, but...when I populate it....in
the resulting Html page there is no value in every checkboxlist item.

I did something like this (suppose that I pass the CheckBoxList as
parameter):

private void
PopulateCheckBoxList(System.Web.UI.WebControls.CheckBoxList control)
{
control.Items.Clear();
for (int i=0; i<10; i++)
{
string Cod = "Value" + i.ToString();
string Text = "Text" + i.ToString();
ListItem item = new ListItem();
item.Text = Text;
item.Value = Cod;
item.Attributes.Add("value",Cod);
control.Items.Add(item);
//control.Items.Add(new System.Web.UI.WebControls.ListItem(Text,
Cod));
}
}

I noticed that the checked values are actually present when I get them
from the c# code, but I need to have them in the html page too. I
tried to add manually the "value" attribute as you can see but I
couldn't get the value in the web page.

I hope somebody can help me
Thanks
Federico
.



Relevant Pages

  • Re: Another basic question: How to call and show one Web Form from another Web Form?
    ... > I've got an ASP.NET Form (Web Form) that contains various info/controls. ... > ' What do I use to load MyWebForm in the current browser window? ... am I being unrealistic in wanting to NOT keep resorting back to HTML ... I find the HTML syntax mind boggling, ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • html forms in aspx pages
    ... I can't seem to get my html form to submit properly from within a web form. ... Here's my form tag syntax and some delivery hidden fields. ... This web form uses a masterpage. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: html forms in aspx pages
    ... side, an HTML form, and you can't nest HTML forms inside one another. ... And then build a web form linking that masterpage and when submitting have ... the server send the results to the cgi file cited so that the cgi file ... I have the form within tags of an asp web form page. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: GET/POST in ASP.Net
    ... database and then also update the data. ... I would like to use the same web form to write the data as the ... So I thought if I create a simple html page with GET or POST data I ... I also know in Javascript I can retrieve the data by coding ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Copying a web form within a project
    ... Most are about html code ... to grid layout, so I won't be able to answer those. ... > when viewing a web form in HTML format, ... right-click the web form and choose Copy. ...
    (microsoft.public.dotnet.framework.aspnet)