Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi All,

This is really a challenging issue I have ever faced in development.
Googled every solution but couldn't find any perfect solution as per my requirement..

I have a generic method in a class file RequestTemplate.cs in which HTML Table is being constructed so that this table will be called in every page of the project when required..
but the Issue is I have created an Input Checkbox in using StringBuilder in that class file. The Method is as following:

C#
private static string generateFeedback(DataTable comments)
    {        
        StringBuilder emailBody = new StringBuilder();
        string PageUrl = HttpContext.Current.Request.Url.ToString();
        if (comments.Rows.Count != 0)
        {
            emailBody.Append("<table border=1 class=footer_border width=100%>");
            emailBody.Append("<td class=body_text align=left bgcolor=gainsboro>");
            emailBody.Append("Comments:");
            emailBody.Append("</td></tr>");
            emailBody.Append("<tr><td>");
            emailBody.Append("<table border=1 class=footer_border width=100%>");
            emailBody.Append("<tr><th width=10%>Date</th><th width=20%>By</th><th width=40%>Comment Description</th><th width=20%>Event</th><th width=10%>Send to Requestor</th></tr>");
                 foreach (DataRow feebbackRow in comments.Rows)
            {              
                emailBody.Append("<tr>");
                emailBody.Append("<td>" + feebbackRow["UAT_DT"].ToString() + "</td>");
                emailBody.Append("<td>" +   ExEMP_PERSONAL.getEmpName(feebbackRow["User_id"].ToString()) + "("+UserRole.getUserRoleString(Convert.ToInt32(feebbackRow["UserRole"].ToString()))+")</td>");
                emailBody.Append("<td>" + feebbackRow["UAT_Feedback"].ToString() + "</td>");
                emailBody.Append("<td>" + FeedbackState.getDescription(feebbackRow["State"].ToString()) + "</td>");
               emailBody.Append("<td><input id='sbchk' name='sbchk' value='" + feebbackRow["ID"].ToString() + "' type='checkbox'/></td>");
                
               
                emailBody.Append("</tr>");
            }
            emailBody.Append("</table></table>");
        }


And in this same class file I have another function in which I have calling this function.
Here is the Parent Method of that class file:

C#
public static string displayOneTask(string taskNo, string empCode, HttpRequest Request)
    {
        StringBuilder emailBody = new StringBuilder();
        ExRE_TASKCTRL dataObj = new ExRE_TASKCTRL(Conn.getConnection());
        string parenttask = dataObj.getParentTaskNo(taskNo);

        DataRow dr = dataObj.getDetailsForATask(taskNo);
        ExRE_UATFUP feedbackObj = new ExRE_UATFUP(Conn.getConnection()); ;
        DataTable comments;        
        comments = feedbackObj.getAllFeedBackForATask(currTask); // CALLING DATA FROM DATABASE
        emailBody.Append(generateFeedback(comments));
        emailBody.ToString();
        return emailBody.ToString();

    }




Now the main issue is that i cannot get the checkboxes values in my other web forms on button click.
Note that i cannot use runat server control as all the forms are in html.
I cannot get the values from request.querystring.get("sbchk"); it gives me null values.
I cannot use javascript to get the checked checkbox values as i have to add hidden field with runat server in it which is also not possible for me to apply in this form.
Here is my method of another page:

C#
string checks = Request..QueryString.Get("sbchk");
if (checks != null)
{
    string[] checksList = checks.Split(',');
    foreach (string checkstatus in checksList)
    {
        ExRE_UATFUP.updateCheckStatus(taskNo, 1, checkstatus); // METHOD TO UPDATE FIELDS WITH CHECKBOX VALUES WHICH ARE CONSTRUCTED IN THAT OTHER CLASS FILE.
    }
}

As i cannot write all the code here in ask question...so here is the link in which i have mentioned the aspx form code in which i am using that 'displayonetask' method:
The Class File Issue.[^]

Please help in this issue.

Thanks :)
Posted
Updated 12-May-14 1:10am
v6
Comments
Richard MacCutchan 28-Nov-13 7:30am    
DON'T SHOUT.
AR547 28-Nov-13 7:32am    
peace peace peace :)

1 solution

plz refer following link for how to work with html checkbox

http://stackoverflow.com/questions/8759663/how-to-implement-a-check-box-in-classic-asp[^]


and refer following link for how to get value of checkbox from javascript
http://stackoverflow.com/questions/11599666/get-the-value-of-checked-checkbox[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900