Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have a datagrid on a page, and I would like to fire an event when someone clicks on either a row or a cell in the datagrid, to populate other textboxes on the page depending on what they select in the datagrid.

 

Is there a way to do this? What is the syntax?

 

thanks,

 

-JBD

Posted

this works great thanks, but the only problem Im having now is that on the FIRST time I click in the cell, nothing happens but from then on when I click in the cell it does work, why is this not working on the first time? thanks.

 

-JBD

  • Moderators
Posted

Use a member boolean variable (form level) and and set it to true once the DG has been clicked for the first time.

 

All this is because CurrentCellChanged and Click (or Enter) will all fire each time you click the grid, so you need to determine the very first time it's clicked.

Visit...Bassic Software
Posted

Okay, I'm a newbie but trying hard so please bear with me : )

 

so I set a variable at the top of the form, not in a sub right? (that makes it "form level") like this:

 

Dim varFirstClick as boolean = false

 

Then, when the datagrid is clicked, I run a sub for the click, and say

 

if varFirstClick is false then

 

Dim myCellValue As string= CType(myDatagrid.Item(myDatagrid.CurrentRowIndex, 0), String)

 

varFirstClick = true

 

end if

 

Something like this? Am I missing anything? I really do appreciate your help, thanks much.

 

-JBD

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...