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:
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:
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);
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:
string checks = Request..QueryString.Get("sbchk");
if (checks != null)
{
string[] checksList = checks.Split(',');
foreach (string checkstatus in checksList)
{
ExRE_UATFUP.updateCheckStatus(taskNo, 1, checkstatus);
}
}
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 :)