>><asp:Table id="tblProInfo" runat="server"></asp:Table> >>>>
>><table id="tblProInfo" runat="server"><table> >>>>
><table cellpadding="6" id="tblProInfo" runat="server" visible="false"> > ><tr>I'm not sure what's really being rendered into your HTML instead of the client ID, but at any rate (from reading your other messages), I'm not sure this is the best way to go about this. The object model available on the server side is not the same model available on the client side. So you really don't have access to the rows (and data in the rows) in the same manner. You can do it through Javascript and the DOM (Document Object Model), but honestly that's probably more than you want to get into right now.
public partial class TableRowTest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ArrayList list = new ArrayList() { "One", "Two", "Three" }; this.tblTest.DataSource = list; this.tblTest.DataBind(); } protected void tblTest_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.DataItem != null) { HyperLink link = e.Item.FindControl("lnkClick") as HyperLink; if (link != null) { link.Attributes["href"] = "#"; link.Attributes["onclick"] = "return confirm('Navigate to " + e.Item.DataItem.ToString() + "');"; } } } }In the ASPX page, paste this code after the DOCTYPE section:
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:DataGrid runat="server" ID="tblTest" onitemdatabound="tblTest_ItemDataBound"> <Columns> <asp:TemplateColumn HeaderText="Test"> <ItemTemplate> <asp:HyperLink ID="lnkClick" runat="server" Text="<%# Container.DataItem %>"></asp:HyperLink> </ItemTemplate> </asp:TemplateColumn> </Columns> </asp:DataGrid> </div> </form> </body> </html>Run the page. It writes the onclick method for each row as it's bound to the data. Your databinding code will look different since you're probably binding to a DataTable and probably has more than one column (you would usually use the DataBinder.Eval(Container.DataItem, "Column") syntax). I didn't modify the URL it links to, just set it to #, but you can easily do that here - for example, you can have it link to a page and pass in a record value in the querystring.