Hi
I'm using .net 1.1 and want to make an entire row in a datagrid clickable. The datagrid is in a usercontrol that is viewed when the tab is selected, when the user selects a record in the datagrid, I want it to update a few textboxes on another usercontrol that is hidden until the user selects the tab. I would like the user to be able to select anywhere on the row, rather than a given cell.
This is what I've got so far...
<HTML><asp:datagrid id="grd" runat="server" CellPadding="2" GridLines="None" AllowSorting="True" AutoGenerateColumns="False" Width="100%" ShowHeader="True">
<Columns>
<asp:BoundColumn Visible="False" DataField="P_ID" ReadOnly="True" HeaderText="P_ID"></asp:BoundColumn>
<asp:ButtonColumn DataTextField="Name" HeaderText="Name">
<HeaderStyle CssClass="CSShead"></HeaderStyle>
<ItemStyle Width="20%"></ItemStyle>
</asp:ButtonColumn>
</Columns>
</asp:datagrid>
<CODE>
Private Sub grd_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grd.ItemDataBound
e.Item.Attributes("onclick") = "javascript:alert(" + e.Item.ItemIndex.ToString + ")"
End Sub
Any help would be greatly appreciated
lbob
I'm using .net 1.1 and want to make an entire row in a datagrid clickable. The datagrid is in a usercontrol that is viewed when the tab is selected, when the user selects a record in the datagrid, I want it to update a few textboxes on another usercontrol that is hidden until the user selects the tab. I would like the user to be able to select anywhere on the row, rather than a given cell.
This is what I've got so far...
<HTML><asp:datagrid id="grd" runat="server" CellPadding="2" GridLines="None" AllowSorting="True" AutoGenerateColumns="False" Width="100%" ShowHeader="True">
<Columns>
<asp:BoundColumn Visible="False" DataField="P_ID" ReadOnly="True" HeaderText="P_ID"></asp:BoundColumn>
<asp:ButtonColumn DataTextField="Name" HeaderText="Name">
<HeaderStyle CssClass="CSShead"></HeaderStyle>
<ItemStyle Width="20%"></ItemStyle>
</asp:ButtonColumn>
</Columns>
</asp:datagrid>
<CODE>
Private Sub grd_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grd.ItemDataBound
e.Item.Attributes("onclick") = "javascript:alert(" + e.Item.ItemIndex.ToString + ")"
End Sub
Any help would be greatly appreciated
lbob