Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I got a problem of how to identify the cell was clicked in datagrid. In my datagrid, there are 10 template column and each column have a label and image button. I want to hide the label when user click the image button.

 

I do not know which row of cell is clicked but column. I create a command to the button, for example:

 

HTML:

 

<asp:ImageButton id="btnEdit1" runat="server" ImageUrl=="../Images/Icon.gif" CommandArgument="1" OnClick="GetControl"></asp:ImageButton>

 

CodeBehind(VB.NET)

 

Public Sub GetControl(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)

 

Select Case "e.CommandArgument"

Case "1" 'Column 1

Dim Label1 as Label = DataGrid1.item(??).FindControl("Label")

Label1.visible = False

Case "2" 'Column 2

...

End Select

 

End Sub

 

Notice the ??(row), how can I get it???????

 

I was struggle on this problem couple of day, appreciate for any help! :)

 

Calvin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...