OnButtonClick make an individual cell visible/invisible?

R

Roy

What is the best way to approach this problem? I have a datagrid with
an imagebutton. When one clicks the imagebutton it triggers an onClick
sub which makes column 9 (a user control) visible or invisible. Only
problem is when one clicks the imagebutton on a specific row, I want
*only* that row's column 9 to appear or disappear.


********My imagebutton*******************
<asp:TemplateColumn><ItemTemplate>
<asp:ImageButton id="imagebutton1" runat="server"
AlternateText="ImageButton 1" ImageAlign="left"
ImageUrl="arrow_right.gif" OnClick="ImageButton_Click"/>
</ItemTemplate></asp:TemplateColumn>


*********My user control (row 9)*********
<asp:TemplateColumn Visible = "false">
<ItemTemplate><tr><td colspan="9">
<UC_Grid:Nested id="FVDGrid" x=<%# container.dataitem("vown")%> y=<%#
container.dataitem("van_no")%> runat="server" />
</td></tr></ItemTemplate>
</asp:TemplateColumn>


**********My click sub**********
Public Sub ImageButton_Click(sender As Object, e As
ImageClickEventArgs)
If MR_Grid.Columns(9).Visible = False Then
MR_Grid.Columns(9).Visible = True
Else
MR_Grid.Columns(9).Visible = False
End If
End Sub


I tried modifying the sub with the individual cell as seen below, but
that bombs out with your average "'Item' is not a member of
'System.Web.UI.ImageClickEventArgs'" error. Anyone have any clues on
how I can implement this functionality?

Public Sub ImageButton_Click(sender As Object, e As
ImageClickEventArgs)
If e.Item.Cells(9).Visible = False Then
e.Item.Cells(9).Visible = True
Else
e.Item.Cells(9).Visible = False
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top