Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datagrid with client side scripting...

Status
Not open for further replies.

TPetersonFlorida

Programmer
Aug 8, 2003
76
US
Here's the situation:

I have a datagrid with the first column being a hyperlinkcolumn. I want to put some client-side scripting on this column, specifically a OnMouseOver event. Here is the code for the datagrid:

<form id=&quot;editDataGrid&quot; runat=&quot;server&quot;>
<ASP:DATAGRID id=&quot;MyDataGrid&quot; runat=&quot;server&quot; PageSize=&quot;20&quot; AllowPaging=&quot;True&quot; HorizontalAlign=&quot;Center&quot; CellPadding=&quot;3&quot; HeaderStyle-BackColor=&quot;#ff0000&quot; HeaderStyle-Font-Name=&quot;arial&quot; HeaderStyle-Font-Bold=&quot;True&quot; HeaderStyle-Font-Size=&quot;11&quot; HeaderStyle-ForeColor=&quot;#ffffff&quot; AlternatingItemStyle-BackColor=&quot;#ffffcc&quot; ItemStyle-Font-Name=&quot;arial&quot; ItemStyle-Font-Size=&quot;10&quot; OnPageIndexChanged=&quot;MyDataGrid_Paged&quot; OnItemDataBound=&quot;MyDataGrid_ItemDataBound&quot; AutoGenerateColumns=&quot;False&quot; BorderColor=&quot;Black&quot; BackColor=&quot;White&quot; Width=&quot;800px&quot;>
<FooterStyle BackColor=&quot;RoyalBlue&quot;></FooterStyle>
<HeaderStyle Font-Size=&quot;X-Small&quot; Font-Names=&quot;arial&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; BackColor=&quot;RoyalBlue&quot;></HeaderStyle>
<PagerStyle Font-Size=&quot;Small&quot; Font-Bold=&quot;True&quot; BorderStyle=&quot;Dotted&quot; HorizontalAlign=&quot;Right&quot; ForeColor=&quot;Black&quot; BackColor=&quot;RoyalBlue&quot; Mode=&quot;NumericPages&quot;></PagerStyle>
<AlternatingItemStyle BackColor=&quot;AliceBlue&quot;></AlternatingItemStyle>
<ItemStyle Font-Size=&quot;XX-Small&quot; Font-Names=&quot;arial&quot; BackColor=&quot;Lavender&quot;></ItemStyle>
<Columns>
<asp:HyperLinkColumn ItemStyle-Width=&quot;30px&quot; Text=&quot;Details&quot; DataNavigateUrlField=&quot;MPNID&quot; DataNavigateUrlFormatString=&quot;javascript:var w=window.open('webform1.aspx?RecID={0}','_Dwg','width=750,height=450,left=100,top=100,toolbar=No, location=no, directories=no,status=no, menubar=no, scrollbars=no,resizable=no');&quot; NavigateUrl=&quot;webform1.aspx&quot;></asp:HyperLinkColumn>
<asp:BoundColumn Visible=&quot;False&quot; DataField=&quot;MPNID&quot; HeaderText=&quot;MPNID&quot;>
<ItemStyle HorizontalAlign=&quot;Center&quot;></ItemStyle>
</asp:BoundColumn>
.
.
.

I thought this could be accomplished using the ItemDataBound event but can't seem to figure out how to get a reference to that column in the grid.

Thanks in advance!
 
Use a TemplateColumn with <asp:HyperLink> in ItemTemplate instead of a HyperLinkColumn. Then in the ItemDataBound you can get a reference to the HyperLink inside this column.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top