R
Raymond Du
Hi,
I am having problem RadioButtonList class, I have a page that populates a
RadiobuttonList during non-postback, but after postback, all attributes I
added disppear. Here is my code snippet;
//Inside Page_Load, I have:
{
/* some codes go here */
if (!isPostback)
RenderForm();
}
function void RenderForm()
{
/* some codes go here */
int i = 0;
foreach (VoteItem vi in voteItemList)
{
ListItem l = new ListItem();
l.Value = vi.Vote;
l.Text = vi.DisplayText;
// the following 2 lines add attributes to each list item
// but they disappear after postback
l.Attributes.Add("class", "VoteItem");
l.Attributes.Add("id", "span_" + i.ToString());
//vote is a RadioButtonList
vote.Items.Add(l);
i++;
}
/* some codes go here */
}
Is this the way it's supposed to be? How do I keep the attribute values
during postback/
TIA
I am having problem RadioButtonList class, I have a page that populates a
RadiobuttonList during non-postback, but after postback, all attributes I
added disppear. Here is my code snippet;
//Inside Page_Load, I have:
{
/* some codes go here */
if (!isPostback)
RenderForm();
}
function void RenderForm()
{
/* some codes go here */
int i = 0;
foreach (VoteItem vi in voteItemList)
{
ListItem l = new ListItem();
l.Value = vi.Vote;
l.Text = vi.DisplayText;
// the following 2 lines add attributes to each list item
// but they disappear after postback
l.Attributes.Add("class", "VoteItem");
l.Attributes.Add("id", "span_" + i.ToString());
//vote is a RadioButtonList
vote.Items.Add(l);
i++;
}
/* some codes go here */
}
Is this the way it's supposed to be? How do I keep the attribute values
during postback/
TIA