Re: bug? cannot get value of cell on invisible column

Tech-Archive recommends: Fix windows errors by optimizing your registry



Any server control with Visible property set to false doesn't get rendered
to the client and doesn't come back on postbacks. You need to hide it with a
css rule display:none.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Beemer Biker" <jstateson@xxxxxxxx> wrote in message
news:1334djrdvnqu314@xxxxxxxxxxxxxxxxxxxxx
This is strange - I have a grid with columns: id, authString, realName,
lastLogin, administrator, files_path_prefix

id is a primary key in sql table. I didn't want the id to show up when
clicking on gridview "edit" command so I made that column invisible. This
works nicely and one does not see the id field when the grid is displayed
nor is it editable.

But now I cannot programmatically subscript cell and pull out the value of
the id ...bug or feature??

GridView4Users.Rows[i].Cells[idID].Text.ToString() is ""
instead of the string value of the user id. As soon as I make the column
visible the value then shows up eg: "4" instead of "" if id value was 4


Then I made the column visible but the field readonly and that caused the
sql "update" command to fail as the update command skipped over that "id"
field and put "authString" where id was supposed to go causing an
exception on the sqlserver.

UPDATE "Users" SET "authString"=?,
"realName"=?,"lastLogin"=?,"administrator"=?, "files_path_prefix"=? WHERE
"id" = ?

Looking at the server, WHERE "id" = someones-name shows up instead of
WHERE "id" = 4 anytime I make that field read-only.
I tried changing the order of the parameters leaving some out putting id
in twice, everying I could think of but never got the correct setting to
allow the sql command to execute. This is what it looks like when it is
working and visible.
http://stateson.net/pub/bug_sql_r19.png

Is there some other way to get the value of that id field and still have
the column invisible to the user? Can I do something programmatically
like set ...row[i].Selected=True; and then get the value from
sqlDataSource? Alternately, I can put id values into a databound list and
access that list instead of the grid. Just got to make that list 1 px
wide so no one can see it (??)

note that i am using postgresql and not mssql.

--
======================================================================
Joseph "Beemer Biker" Stateson
http://TipsForTheComputingImpaired.com
http://ResearchRiders.org Ask about my 99'R1100RT
======================================================================





.



Relevant Pages

  • SqlDataSource1_Selected not always firing
    ... The above fires off the SqlDataSource1_Selected just fine unless the "sqlcmd" is identical to the previous one. ... GridView1_RowDataBound is not fired either which causes some images to disappear from the grid during repaint. ... If I change the WHERE clause or page to another page index the _Selected fires twice but that does not seem to hurt anything. ... Before I tried GridView1.DataBindI tried a .Selectand that was not any better: _Selected was not fired irregardless on a repeated SQL command. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: SQL data to Grid Control
    ... One big problem - when I use a cursor in RecordSource and run the form it ... How do I get the grid to display within the form when using RecordSource? ... > I can't help you with the builder - I don't use it. ... > To use the SQL command directly in a grid, ...
    (microsoft.public.fox.vfp.queries-sql)
  • Re: setting recordsource in a grid at runtime resets all column information in a grid
    ... > they are displayed in the grid to see if that works. ... > On Escape Do SQLCancel ... > * clear recordsource before sql command, ... >> recordsource, ...
    (microsoft.public.fox.helpwanted)
  • Re: SQL data to Grid Control
    ... I can't help you with the builder - I don't use it. ... To use the SQL command directly in a grid, ... property to 4 (SQL statement) and enter the SQL command as the ...
    (microsoft.public.fox.vfp.queries-sql)