SqlCommand cmd = new SqlCommand(); int ID = 0; try { cmd.Connection = con; cmd.CommandText = "SELECT TOP(10) s_JobDesignation,s_JobDescription,s_NoOfVacancies,s_DatePosted,s_JobCategoryID FROM [OfinityJobSearch].[dbo].[tx_ListOfJobs] WHERE s_IndustryName='" + industryName + "' ORDER BY s_JobId ASC "; cmd.CommandType = CommandType.Text; if (cmd.Connection.State == ConnectionState.Closed) cmd.Connection.Open(); using (SqlDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { JobDesignation = reader.GetString(0); JobDescription = reader.GetString(1); NoOfVacancies = Convert.ToString(reader.GetInt32(2)); DatePosted = Convert.ToString(reader.GetDateTime(3)).Replace("00:00:00", ""); jobId = reader.GetString(4); int tblRows = 1; int tblCols = 1; Table tbl = new Table(); PlaceHolder1.Controls.Add(tbl); for (int i = 0; i < tblRows; i++) { readerrowcount = readerrowcount + 1; TableRow tr = new TableRow(); tr.CssClass = "rowStyle1"; for (int j = 0; j < tblCols; j++) { TableCell tc = new TableCell(); tc.CssClass = "cellStyle1"; System.Web.UI.WebControls.Label txtBox = new System.Web.UI.WebControls.Label(); txtBox.Text = "Job ID:" + jobId + "<br />" + "Job Designation:" + JobDesignation + "<br />" + "Job Description:" + JobDescription + "<br />" + "Vacancies:" + NoOfVacancies + "<br />" + "Ad Posted On:" + DatePosted + "<br />"+""; tc.Controls.Add(txtBox); tr.Cells.Add(tc); System.Web.UI.WebControls.LinkButton lbView = new System.Web.UI.WebControls.LinkButton(); lbView.Text = "<br />" + "Apply for this Job"; lbView.Click += new EventHandler(lbView_Click); lbView.OnClientClick = "return RedirectTo('" + id + "')"; tc.Controls.Add(lbView); tr.Cells.Add(tc);} tbl.Rows.Add(tr); } ViewState["dynamictable"] = true; } reader.NextResult(); } } }
Try it in JQuery...Write the below code with in document ready function of jQuery. $(document).ready(function(){ $("#id_of_dynamic_link_button").live("click", function () { alert("Link_return button fired successfully"); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)