473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Datagrid won't post variables if hidden

For some reason, why does ASP.net only see variables that are 'DISPLAYED'
inside a datagrid?

Even if the Field is Databound, I cannot post the variable or use it in an
updatecommand... it has to be visible??
I've tried putting the field on the page but making 'Visible = false' but it
still dosen't want to post or anything.
Is it a bug in Visual Web Developer 2005?
Cheers
Feb 25 '06 #1
4 1059
Sorry, I meant Gridview
"Nick" <nc**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For some reason, why does ASP.net only see variables that are 'DISPLAYED'
inside a datagrid?

Even if the Field is Databound, I cannot post the variable or use it in an
updatecommand... it has to be visible??
I've tried putting the field on the page but making 'Visible = false' but
it still dosen't want to post or anything.
Is it a bug in Visual Web Developer 2005?
Cheers

Feb 25 '06 #2
I have a hidden (primary key) object in my GridView:

<asp:HiddenField ID="hidRemUUID" runat="server" Value='<%# Eval("MyUUID")
%>' />
Now, there is a more elegant way to keep track of the primary key... with a
GridView.

You might want to look into this also:
DataKeyNames="MyUUID" (this is declared in the <asp:GridView> element.

Then you can get to it like this:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs
e)
{
GridView gv = (GridView)sender;

//string str0 = gv.DataKeyNames[0];

System.Guid uuid = (System.Guid)gv.DataKeys[gv.SelectedIndex].Value;

// or
//string uuid = (string)gv.DataKeys[gv.SelectedIndex].Value; //
}

"Nick" <nc**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Sorry, I meant Gridview
"Nick" <nc**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For some reason, why does ASP.net only see variables that are 'DISPLAYED' inside a datagrid?

Even if the Field is Databound, I cannot post the variable or use it in an updatecommand... it has to be visible??
I've tried putting the field on the page but making 'Visible = false' but it still dosen't want to post or anything.
Is it a bug in Visual Web Developer 2005?
Cheers


Feb 25 '06 #3
I had a similar issue, i wanted to hide the autonumberfield.
Afaik i used a hidden div enclosing the item in a template.
If you really need to know, let me know, i have to look it up.
"Nick" <nc**********@gmail.com> schreef in bericht
news:%2****************@TK2MSFTNGP12.phx.gbl...
Sorry, I meant Gridview
"Nick" <nc**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For some reason, why does ASP.net only see variables that are 'DISPLAYED'
inside a datagrid?

Even if the Field is Databound, I cannot post the variable or use it in
an updatecommand... it has to be visible??
I've tried putting the field on the page but making 'Visible = false' but
it still dosen't want to post or anything.
Is it a bug in Visual Web Developer 2005?
Cheers


Feb 25 '06 #4
Hi Nick,

In DataGrid, you can apply invisible boundcolum to store data for using in
postback. However, in GridView invisible boundfield’s data cannot be
retrieved after postback. Good news is that you can use GridView.DataKeyNames
to speify multi-fields data then retrieve them by
GridView.DataKeys[row_indec].Values[col_index].

HTH

Elton Wang

"Nick" wrote:
Sorry, I meant Gridview
"Nick" <nc**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
For some reason, why does ASP.net only see variables that are 'DISPLAYED'
inside a datagrid?

Even if the Field is Databound, I cannot post the variable or use it in an
updatecommand... it has to be visible??
I've tried putting the field on the page but making 'Visible = false' but
it still dosen't want to post or anything.
Is it a bug in Visual Web Developer 2005?
Cheers


Feb 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Derek | last post by:
Another DGrid question... I can not access the values of a cell in a datagrid unless I make them visible. I do not want these fields displayed. I only want to use the values to run a stored...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
2
by: Bruce W.1 | last post by:
There's something I can't figure out. I added some javascript behavior to my datagrid, just like in this article, except in C# instead of VB: ...
2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
8
by: Rich Wallace | last post by:
Hi all, Is there a way I can design the datagrid where, if the SelectedIndex changes and I highlight the selected row, that the grid does not re-write itself and keep the current page smooth, or...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
24
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button...
3
by: Yourself | last post by:
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want to replicate a form like the following, but create the variables dynamically from code behind: <form...
2
by: adamace5o | last post by:
When i try to use post variables with php and mysql i can't get the insert into statement to accept varibles as values. If i use 'test' instead of $test it does work. I suspect it is something to do...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.