I've written a table in a stringbuilder that adds rows to the table depending on how many records are in a database. Each row is supposed to have three buttons that call different functions in code behind. Here's an example of what I mean:
using (superCommand)
{
using (SqlDataReader employeeReader = superCommand.ExecuteReader())
{
while (employeeReader.Read())
{
string employee = employeeReader[0].ToString();
tString.Append(
"<tr style=\"padding: 15px;\">" +
"<td style=\"text-align: left; width:250px;\">" +
employee +
"</td>" +
"<td style=\"text-align: center;\">" +
employeeReader[1] +
"</td>" +
"<td style=\"text-align: center;\">" +
employeeReader[2] +
"</td>" +
"<td style=\"text-align: center;\">" +
"<button type=\"button\" >Print</button>" +
"</td>" +
"<td style=\"text-align: center;\">" +
"<button type=\"button\">Close And Lock</button>" +
"</td>" +
"<td style=\"text-align: center;\">" +
"<button runat=\"server\" onclientclick=\"viewEmployee(\"" + employee + "\")\">View</button>" +
"</td>" +
"</tr>"
);
}
}
}
That onclientclick is supposed to call a function that is written in the code behind also. I know I should've probably written this using another method, but I would like to try to get this to work. Any idea on how to get these buttons to fire?