Hopefully there is a solution for this. What i have is somewhat limiting. First of all i'm using a master page in my source which is preventing me from inserting javascript functions in to my aspx body. When i try i get the error "This page contains markup that is not valid when attached to a master page" as my page is defined as:
<%@ Page Title="" Language="C#" MasterPageFile="~/nav/HorizMenu.Master" AutoEventWireup="true" CodeFile="TEST.aspx.cs" Inherits="WebForms_TEST" %>
<%@ MasterType virtualpath="~/nav/HorizMenu.Master" %>
My next challenge is that i am populating a table using the asp placeholder control:
aspx:
<div class="row">
<div class="col s12">
<ul class="tabs">
<li class="tab"><a href="#Total">Total (
<asp:PlaceHolder ID="DBTotalCount" runat="server"></asp:PlaceHolder>
<!--Records #-->)</a></li>
<li class="tab"><a href="#Pending">Pending (
<asp:PlaceHolder ID="DBPendingCount" runat="server"></asp:PlaceHolder>
)</a></li>
<li class="tab"><a href="#Approved">Approved (
<asp:PlaceHolder ID="DBApprovedCount" runat="server"></asp:PlaceHolder>
)</a></li>
</ul>
</div>
</div>
cs:
//Set up Total column
for (var i = 0; i < ds.Tables["tblTotal"].Rows.Count; i++)
{
//force empty string to prevent null errors
var rowName = string.IsNullOrEmpty(ds.Tables["tblTotal"].Rows[i]["Name"].ToString()) ? "" : ds.Tables["tblTotal"].Rows[i]["Name"];
var rowAddress = string.IsNullOrEmpty(ds.Tables["tblTotal"].Rows[i]["Address"].ToString()) ? "" : ds.Tables["tblTotal"].Rows[i]["Address"];
var rowId = string.IsNullOrEmpty(ds.Tables["tblTotal"].Rows[i]["ID"].ToString()) ? "" : ds.Tables["tblTotal"].Rows[i]["ID"];
var rowGuid = string.IsNullOrEmpty(ds.Tables["tblTotal"].Rows[i]["CustGUID"].ToString()) ? "" : ds.Tables["tblTotal"].Rows[i]["CustGUID"];
var rowDob = string.IsNullOrEmpty(ds.Tables["tblTotal"].Rows[i]["DateOfBirth"].ToString()) ? "" : ds.Tables["tblTotal"].Rows[i]["DateOfBirth"];
var rowUrl = startURL(Request["isadmin"] != "0", rowGuid.ToString());
//write out this row
htmlTotal.Append("<tr>");
htmlTotal.Append(@"<td>");
htmlTotal.Append(@"<a href=" + rowUrl + "> " + rowName + @"</a>");
htmlTotal.Append(@"</td>");
htmlTotal.Append(@"<td>");
htmlTotal.Append(@"<a href=" + rowUrl + "> " + rowAddress + @"</a>");
htmlTotal.Append(@"</td>");
htmlTotal.Append(@"<td>");
htmlTotal.Append(@"<a href=" + rowUrl + "> " + rowId + @"</a>");
htmlTotal.Append(@"</td>");
htmlTotal.Append(@"<td>");
htmlTotal.Append(@"<a href=" + rowUrl + "> " + rowDob + @"</a>");
htmlTotal.Append(@"</td>");
htmlTotal.Append(@"<td>");
htmlTotal.Append(@"<input type=""checkbox"" Enabled=""true"" name=""chkTotal" + i + @""" value=""" + "VAL" + i + @""">"); //email check box
htmlTotal.Append(@"</td>");
htmlTotal.Append("</tr>");
}
}
else
{
htmlTotal.Append("<tr>");
htmlTotal.Append("<td align='center' colspan='6'>No Results Found</td>");
htmlTotal.Append("</tr>");
htmlTotal.Append("</table>");
htmlTotalCount.Append("0");
}
//link the page dynamic control back to the html string builder code
DBTotal.Controls.Add(new Literal { Text = htmlTotal.ToString() });
DBTotalCount.Controls.Add(new Literal { Text = totalRecords.ToString() });
htmlTotalCount.Append(" of " + totalRecords + " results");
DBTotalCount2.Controls.Add(new Literal { Text = htmlTotalCount.ToString() });
TotalPagination.Controls.Add(new Literal { Text = htmlTotalPagination.ToString() });
you can see above where i started adding in the check boxes.
My challenge is that i need to add a check box at the trail of each row loop that i can tick, and when i click the asp button control i can return a value specified by that given row for each check box that the user has checked.
Given that my master page is preventing me from using JS, and that i'm using a placeholder control to construct the page HTML on the fly, any idea if what i need to accomplish here is possible, and if so, how?
Thank you for your help!
Aucun commentaire:
Enregistrer un commentaire