I'm moving from years with the datagrid to a new project, .net 2.0, using
GridView controls. Per past practice, it is often a lot easier to inject
controls (or special formatting) in RowDataBound (formerly ItemDataBound)
than to mess with complicated templates, especially for things that are
consistent across grids or columns. GridView is dumping all the nice stuff
put there during a RowDataBound event.
Ex: those "!" icons in outlook or classification (confidential) markings on
a row-by-row basis. In the datagrid, this worked not just well, but very
well. Once in the grid, it stayed in the grid, including postbacks from other
controls.
Now the GridView simplifies a lot of stuff like sorting, but it also wants
to invoke the DataBinding (and DataBound) event for any postback - a (new
item) button, a calendar, parent-child-linked-down bunch of dropdown lists,
whatever.
The GridView doesn't remember what what was done in RowDataBound - dumps
everything. Is there an easy way to not have it bind when the postback is
caused by a non-GridView control? Or force it to just re-bind everything? The
values of the bound columns are all there after postback - but that's all.
If I have to go to templates I will, but that means I can't re-use stuff in
nice objects/classes/common static methods (which way varies with use), which
is a much cleaner approach in the long run.
If anybody knows a nice shortcut, please speak up.
--
Wesley Davis
Web Application Developer
It''s all about getting the job done 1 11132
It sounds like the GridView property EnableViewState is set to false. By
default it is usually set to true. Set this property to true e.g.
myGridView.EnableViewState = true;
This should keep the data in the GridView on postbacks with out the need to
re-bind to the data source.
"Wesley Davis, General Dynamics" wrote:
I'm moving from years with the datagrid to a new project, .net 2.0, using
GridView controls. Per past practice, it is often a lot easier to inject
controls (or special formatting) in RowDataBound (formerly ItemDataBound)
than to mess with complicated templates, especially for things that are
consistent across grids or columns. GridView is dumping all the nice stuff
put there during a RowDataBound event.
Ex: those "!" icons in outlook or classification (confidential) markings on
a row-by-row basis. In the datagrid, this worked not just well, but very
well. Once in the grid, it stayed in the grid, including postbacks from other
controls.
Now the GridView simplifies a lot of stuff like sorting, but it also wants
to invoke the DataBinding (and DataBound) event for any postback - a (new
item) button, a calendar, parent-child-linked-down bunch of dropdown lists,
whatever.
The GridView doesn't remember what what was done in RowDataBound - dumps
everything. Is there an easy way to not have it bind when the postback is
caused by a non-GridView control? Or force it to just re-bind everything? The
values of the bound columns are all there after postback - but that's all.
If I have to go to templates I will, but that means I can't re-use stuff in
nice objects/classes/common static methods (which way varies with use), which
is a much cleaner approach in the long run.
If anybody knows a nice shortcut, please speak up.
--
Wesley Davis
Web Application Developer
It''s all about getting the job done
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Simon Strandgaard |
last post by:
Hi group,
my setup:
I have a GridView that extracts data from my table (a SqlDataSource).
For each row, I have an 'edit' button and a 'delete' button.
The 'edit' button opens a popup, through...
|
by: Flinky Wisty Pomm |
last post by:
Hi all, I've got a really annoying problem that I need to fix sharpish.
I've got a GridView derived control which has a templated header and
footer. It works wonderfully on the first render but...
|
by: bsaran |
last post by:
Hi, I have a code that sort of works. The event flow is as follows:
In a user control of type "FilterControl" user selects certain values
from 3 related dropdown lists. (two of them have auto...
|
by: yeltsin27 |
last post by:
I need some advice on handling dynamically added controls in a
GridView.
My app takes an uploaded CSV file containing addresses, converts it to
a DataTable, databinds the DataTable to a...
|
by: hartbypass |
last post by:
Hello all.
I am trying to interate thorugh by GridView data to pump each cell of
each row into a stored proc to load to a DB. I seem to be having a
heck of a time getting the Columns.Count to...
|
by: Cindy Lee |
last post by:
When I do a sorta on 1 table, then the other table goes back to the original
order.
What can I set so, it keeps the order of the other current gridview's order.
I set all the gridview values...
|
by: gerry |
last post by:
The PagerSettings.Visible property is not being handled properly by the
GridView control.
The value assigned to this property is not applied until after a postback.
Simplest test :
.aspx...
|
by: Craig Buchanan |
last post by:
I dynamically add data-bound templates to a gridview in my ascx control.
while this works correctly when the gridview is databound to the
datatable, i'm having issues on postback.
i would like...
|
by: BiffMaGriff |
last post by:
Hello,
I have a GridView that I put inside an update panel.
I have a control that attaches to the datasource of the gridview that filters the data, databinds the gridview and then updates the...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
| |