|
|
|
start date: Fri, 27 Apr 2007 12:44:27 -0500,
posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol
back
| Thread Index |
|
1
Beemer Biker
|
|
2
Beemer Biker
|
|
3
Eliyahu Goldin
|
|
4
Beemer Biker
|
|
5
Beemer Biker
|
|
6
Ross Culver
|
bug? cannot get value of cell on invisible column
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
======================================================================
Date:Fri, 27 Apr 2007 12:44:27 -0500
Author:
|
Re: bug? cannot get value of cell on invisible column
Microsoft says this is a security feature but does provide a workaround ....
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=109485
"Beemer Biker" wrote in message
news:1334djrdvnqu314@corp.supernews.com...
> 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
> ======================================================================
>
>
>
Date:Sat, 28 Apr 2007 09:38:17 -0500
Author:
|
Re: bug? cannot get value of cell on invisible column
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" wrote in message
news:1334djrdvnqu314@corp.supernews.com...
> 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
> ======================================================================
>
>
>
Date:Sun, 29 Apr 2007 11:29:39 +0300
Author:
|
Re: bug? cannot get value of cell on invisible column
"Eliyahu Goldin" wrote in
message news:uE3iJijiHHA.4668@TK2MSFTNGP04.phx.gbl...
> 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.
Thanks Eliyahu, that seems to make sense but tt doesnt really need to be
invisible. I just didnt want it to be editable when the EDIT button was
selected based on previous experience with Borland C++ where editing or
renameing a key required it to be propagated to all the tables. It turned
out that the key field was restored to its original value (after the UPDATE)
if the user attempted to edit it, so my concern was needless. However I do
not belive a field should show up as editable when it cant be updated.
If I make the field read-only then it does not show up in the editable
fields after clicking on "EDIT" but the "UPDATE" fails because the field is
skipped over when the parameters are assigned and the WHERE clause gets the
wrong field. Instead of "WHERE 'id' = '5'" I get "WHERE 'id' = 'somebodies
name'" and the error "expected key value not integer" or so on the server.
I submitted this problem to MS here:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=274526
I thought by reordering the parameters or adding an extra ID I could get
the id value in the correct position but I was unable to do it.
Question: Is it possible to "re-open" a closed microsoft feedback case? I
submitted a vote on behave of this feedback but I do not see the case
reopened nor my comment even show up:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=104770
I mentioned that the same problem show up in postgreseql but I cannot find
my comment anywhere and suspect they ignore closed cases.
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "Beemer Biker" wrote in message
> news:1334djrdvnqu314@corp.supernews.com...
>> 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
>> ======================================================================
>>
>>
>>
>
>
Date:Mon, 30 Apr 2007 08:08:06 -0500
Author:
|
Re: bug? cannot get value of cell on invisible column
"Eliyahu Goldin" wrote in
message news:uE3iJijiHHA.4668@TK2MSFTNGP04.phx.gbl...
> 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
Thanks, that worked fine. Set both header and item to display:none and they
disappeared from the grid.
We are using postgresql and did not buy 3rd party drivers for VS8 data
components so all I have is that gridview and SqlDataSource that the ODBC
driver supports. AFAICT one can only get data values from the grid if not
using 3rd part SqlCommands, SqlConnection etc (I dont have those in
toolkit).
thanks again!
Date:Tue, 1 May 2007 17:38:02 -0500
Author:
|
Re: bug? cannot get value of cell on invisible column
Have you tried using the DatakeyNames property of the gridview and then
accessing the selectedrows datakeyvalue?
Something like this: In the SelectedIndexChangedEvent
Me.gv.SelectedDataKey.Item(0).ToString
Ross
"Beemer Biker" wrote in message
news:1334djrdvnqu314@corp.supernews.com...
> 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
> ======================================================================
>
>
>
Date:Thu, 10 May 2007 09:17:20 -0500
Author:
|
|
|