Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6984503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:33:28+00:00 2026-05-27T18:33:28+00:00

First, here is the code. DataRow[] exemption = ds.Tables[2].Select(ValidExemptionTypeID=’2′); foreach (DataRow dr in exemption)

  • 0

First, here is the code.

DataRow[] exemption = ds.Tables[2].Select("ValidExemptionTypeID='2'");
    foreach (DataRow dr in exemption)
    {
        string exemptionType = dr["ValidExemptionTypeID"].ToString();
        string exemptionID = dr["ValidExemptionID"].ToString();
        string exemptionDesc = dr["validExemptionDescription"].ToString();
        string displayLabel = dr["DisplayLabel"].ToString();
        sb.Append("<table><tr><td colspan='3'>&nbsp<br /></td></tr></table>");
        sb.Append("<table align='center' width='730px'>");
        sb.Append("<tr><td width='20px' align='left'><input type=\"checkbox\" ID=\"chk" + exemptionID + "\" runat=\"server\" /></td>");
        sb.Append("<td align='left'><strong>" + exemptionDesc + "</strong></td>");
        sb.Append("</table>");
        sb.Append("<table align='center' width='630px'>");
        sb.Append("<tr><td>" + displayLabel + "</td></tr>");
        sb.Append("<tr><td colspan='2'>&nbsp</td></tr>");
        sb.Append("</table>");
        sb.Append("<table style='border: 1px solid gray' align='center' width='700px'>");
        sb.Append("<tr><td colspan='3'><strong>Select Exeption Reason</strong></td></tr>");
        sb.Append("<tr><td><input type=\"checkbox\" ID=\"chkLocal" + exemptionID + "\" runat=\"server\" /></td>");
        sb.Append("<td align='left'><strong>Local Restriction</strong></td>");
        sb.Append("<td align='left'><i>NOTE: Please limit explanation to xx characters or less</i></td>");
        sb.Append("</tr><tr>");
        sb.Append("<td valign='top'><input type=\"checkbox\" ID=\"chkOther" + exemptionID + "\" runat=\"server\" /></td>");
        sb.Append("<td valign='top' align='left'><strong>Other (Please Specify to the right)</strong></td>");
        sb.Append("<td colspan=><textarea style='width: 390px; max-width: 390px;' id=\"txtOther" + exemptionID + " cols=\"100\" rows=\"2\" wrap=\"virtual\" runat=\"server\"></textarea></td>");
        sb.Append("</tr>");
        sb.Append("</table>");
        sb.Append("<table><tr><td colspan='3'>&nbsp<br /></td></tr></table>");
        count++;
    }
    return sb.ToString();
}

This goes through a datarow array with 14 rows and creates a checkbox for each one, then adds two checkboxes for each row for local and other exemptions. What I just cannot figure out is how to check the boxes in the codebehind to make sure they’re checked. Any suggestions or links to help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:33:28+00:00Added an answer on May 27, 2026 at 6:33 pm

    You have to change a few things. The big problem is you can’t use server tags as a string. So the runat server in your checkboxes isn’t doing anything. if you look at the generated html, you will see runat=”server” is in the HTML.

    so, if you want to take this approach, which is fine, then give the checkboxes a unique name like name=\”chkOther_dr1\” then you can use Request.Form or Request.Params to check to see if the boxes are checked, they will not be part of the collection if they aren’t checked.

    Even if you actually create the server controls you will have the same problem because they will not exist when you try to check them in your postback.
    so…

    DataRow[] exemption = ds.Tables[2].Select("ValidExemptionTypeID='2'");
    foreach (DataRow dr in exemption)
    {
        string exemptionType = dr["ValidExemptionTypeID"].ToString();
        string exemptionID = dr["ValidExemptionID"].ToString();
        string exemptionDesc = dr["validExemptionDescription"].ToString();
        string displayLabel = dr["DisplayLabel"].ToString();
        sb.Append("<table><tr><td colspan='3'>&nbsp<br /></td></tr></table>");
        sb.Append("<table align='center' width='730px'>");
        sb.Append("<tr><td width='20px' align='left'><input type=\"checkbox\" name=\"chk" + exemptionID + "\"  /></td>");
        sb.Append("<td align='left'><strong>" + exemptionDesc + "</strong></td>");
        sb.Append("</table>");
        sb.Append("<table align='center' width='630px'>");
        sb.Append("<tr><td>" + displayLabel + "</td></tr>");
        sb.Append("<tr><td colspan='2'>&nbsp</td></tr>");
        sb.Append("</table>");
        sb.Append("<table style='border: 1px solid gray' align='center' width='700px'>");
        sb.Append("<tr><td colspan='3'><strong>Select Exeption Reason</strong></td></tr>");
        sb.Append("<tr><td><input type=\"checkbox\" name=\"chkLocal_" + exemptionID + "\"  /></td>");
        sb.Append("<td align='left'><strong>Local Restriction</strong></td>");
        sb.Append("<td align='left'><i>NOTE: Please limit explanation to xx characters or less</i></td>");
        sb.Append("</tr><tr>");
        sb.Append("<td valign='top'><input type=\"checkbox\" name=\"chkOther_" + exemptionID + "\" /></td>");
        sb.Append("<td valign='top' align='left'><strong>Other (Please Specify to the right)</strong></td>");
        sb.Append("<td colspan=><textarea style='width: 390px; max-width: 390px;' name=\"txtOther_" + exemptionID + " cols=\"100\" rows=\"2\" wrap=\"virtual\" ></textarea></td>");
        sb.Append("</tr>");
        sb.Append("</table>");
        sb.Append("<table><tr><td colspan='3'>&nbsp<br /></td></tr></table>");
        count++;
    }
    return sb.ToString();
    

    and then to get them use the params / form collection on Request and look for the part before the underscore (use StartsWith).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code: string str; cin>>str; cout<<first input:<<str<<endl; getline(cin, str); cout<<line input:<<str<<endl; The
First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
first post here, and probably an easy one. I've got the code from Processing's
Let me first put the code snippets here. I am just using the ASP.NET
here's the main code at first I thought is was the message box but
Here is the first part of my controller code: public class ControlMController : Controller
First, here is the C# code and the disassembled IL: public class Program<T> {
First, to make my job explaining a bit easier, here's some of my code:
So, here's my question: Why won't the code in the first snippet work when
So first here is some pseudo code of what I want to improve. public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.