-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: yourLepricanFriend
Message 4 in Discussion
The best means of dynamic form objects (checkboxes) is to revert back to using the
Request.Form collection rather than dynamically generated UI controls (Repeaters).
For example the following are functions that generate checkboxes for every category
and subcategory in the system. There are located in the page namespace .aspx.cs
public string listCategories(int pParent)
{
string retVal = "<UL>";
categoryList tCategoryList = categoryList.Cached.withParent(pParent);
for(int i=0; i<tCategoryList.Count; i++)
{
if(i==0 && pParent==0)
retVal += "<INPUT type=\"radio\" id=\"selectedCategory\" checked
name=\"selectedCategory\" value=\"" + tCategoryList.Item(i).categoryId + "\"/><B>" +
tCategoryList.Item(i).categoryName + "</B><BR/>";
else
retVal += "<INPUT type=\"radio\" id=\"selectedCategory\" name=\"selectedCategory\"
value=\"" + tCategoryList.Item(i).categoryId + "\"/><B>" +
tCategoryList.Item(i).categoryName + "</B><BR/>";
if(tCategoryList.Item(i).subCategories.Count>0)
{
retVal += listCategories(tCategoryList.Item(i).categoryId);
}
}
retVal += "</UL>";
return retVal;
} You call the function on the front end using <% listCategories(0)%> From there
you get the check box values like follows
private void Button2_Click(object sender, System.EventArgs e)
{
if(Request.Form["selectedCategory"]!=null)
{
if(util.NumberString(Request.Form["selectedCategory"].ToString()))
{
int iCategoryId = Int32.Parse(Request.Form["selectedCategory"].ToString());
category.getCategory(iCategoryId);
if(category.current.signed)
{
Response.Redirect("/admin/viewCategory.aspx", true);
}
else
{
IWD.systemMessage.New("Category Not Valid");
}
}
}
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]