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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid with Select Checkbox in DIV tag problem

Status
Not open for further replies.

ISPrincess

Programmer
Feb 22, 2002
318
US
I have a datagrid that contains Checkboxes to allow the user to 'Select' a row.
The datagrid is contained within DIV tags.

I would like to call dgGrid_CheckChanged when the checkbox is checked or unchecked in order to highlight the row as a selected item.

This works fine, until the user has scrolled the grid, and selects a row. Since Autopostback must be true on the checkbox in order to fire dgGrid_CheckChanged, the form repositions the grid back to the top. I would like to somehow keep the grid scrolled where it was within the DIV tag.

I am not sure that I explained this very well, but any ideas would be greatly appreciated.

Thanks!

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
ISPrincess: I have a project sitting in front of me this very minute where I have to do the same thing, i.e., have the user 'select' a row or rows using a checkbox within the grid.

I haven't pulled this feat off yet -- could you throw a few pointers this way?? Sure would be a help (this is one area of the DataGrid I have not seen info on). Pushbutton, etc no problem, but a 'static' checkbox???

Appreciate it Princess!
 
Princ: Should have been a bit more specific -- sorry -- ok, you can use the 'checked-changed' property -- good point on the scrolling datagrid, I'll have the same problem as my grid will be within div tags also. I"ll do some background research -- thanks (you had answered my question in your question) -- one of those weeks.
 
Princ: Pls don't kill me for writing all over your thread here -- sorry about that -- but I will be working today on this very same problem. In my case the user will be selecting 1 or more of the checkboxes so its not critical that repositioning take place but in 65% of the cases it will be 1 selection so it should work to begin with.

I agree, it would be very annoying for a DGrid to resume back at the top - also in my particular problem I have to insert a headerless grid within an html table with static headers which is nothing more than a bit tedious mechanically to get working. I'll do some background researching today for this solution.

Perhaps someone will drop in with a ready solution!
 
I found an answer!

Placing SmartNavigation="true" in your <@Page directive Works for IE 5.0 and greater, which is fine for my app.

Here is where I found that information. There is also code that can help you will maintaining scroll position.

sid8_gci931802,00.html


PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
That's interesting IS; I knew (and have that directive) in several pages, for other reasons, but had no idea it could coordinate an internaal division location.

Thanks!
 
IP: If you decide you need a static header over the grid check out: faq855-5366
 
IP: Sorry to bother you -- you may have already seen this but it is a solution for accounting for all checkboxes should more than one be selected inside the DataGrid (and perhaps that is not your case at hand) -- just thought I'd reference it: thread855-907488
 
Thank you for your posts!

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top