Display a table
-
I have created a dynamic table and i one of its td I want to give link for another table which is actually a html table created on aspx page. for (int i = 0; i < dt.Rows.Count; i++) { TableRow trRow = new TableRow(); TableCell tdCell = new TableCell(); TableCell tdCell1 = new TableCell(); string user = dt.Rows[i]["username"].ToString(); tdCell.Text += "<td align='left'><a href='#' class='descriptiontext'>'" + dt.Rows[i]["username"].ToString() + "'</a></td>"; tdCell1.Text += "<td align='left'>'" + dt.Rows[0]["reason"].ToString() + "'</td>" ; trRow.Controls.Add(tdCell); trRow.Controls.Add(tdCell1); RecipientTable.Controls.Add(trRow); } plcUserMessage.Controls.Add(RecipientTable); } } public void FetchSenderMessage(string UserName) { string strSwapEmp, strSwapDate, strSwapReason; DataTable dt = monthdetail.MessageFromEmp(UserName); pnlRequestApproval.GroupingText = dt.Rows[0]["username"].ToString(); pnlRequestApproval.Controls.Add(tblAdmin); strSwapEmp = dt.Rows[0]["swap_candidate"].ToString(); strSwapReason = dt.Rows[0]["swap_reason"].ToString(); strSwapDate = dt.Rows[0]["swapping_date"].ToString(); lblDate.Text = strSwapDate; ddlUser.Text = strSwapEmp; txtUReason.Text = strSwapReason; } I want to call FetchSenderMessage(user) function on anchor tag hreference
-
I have created a dynamic table and i one of its td I want to give link for another table which is actually a html table created on aspx page. for (int i = 0; i < dt.Rows.Count; i++) { TableRow trRow = new TableRow(); TableCell tdCell = new TableCell(); TableCell tdCell1 = new TableCell(); string user = dt.Rows[i]["username"].ToString(); tdCell.Text += "<td align='left'><a href='#' class='descriptiontext'>'" + dt.Rows[i]["username"].ToString() + "'</a></td>"; tdCell1.Text += "<td align='left'>'" + dt.Rows[0]["reason"].ToString() + "'</td>" ; trRow.Controls.Add(tdCell); trRow.Controls.Add(tdCell1); RecipientTable.Controls.Add(trRow); } plcUserMessage.Controls.Add(RecipientTable); } } public void FetchSenderMessage(string UserName) { string strSwapEmp, strSwapDate, strSwapReason; DataTable dt = monthdetail.MessageFromEmp(UserName); pnlRequestApproval.GroupingText = dt.Rows[0]["username"].ToString(); pnlRequestApproval.Controls.Add(tblAdmin); strSwapEmp = dt.Rows[0]["swap_candidate"].ToString(); strSwapReason = dt.Rows[0]["swap_reason"].ToString(); strSwapDate = dt.Rows[0]["swapping_date"].ToString(); lblDate.Text = strSwapDate; ddlUser.Text = strSwapEmp; txtUReason.Text = strSwapReason; } I want to call FetchSenderMessage(user) function on anchor tag hreference
Mansi Arora wrote:
I want to call FetchSenderMessage(user) function on anchor tag hreference
<a href="#" onclick="javascript:return MyFunction();">Click Me</a>
Don't forget to return false from the MyFunction() to avoid postback(or default behaviour). Is this the one you wanted?
Anurag Gandhi.
http://www.gandhisoft.com
Life is a computer program and every one is the programmer of his own life.