Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Visible Property Set to False Inserts Null Value in Database (http://www.velocityreviews.com/forums/t380576-visible-property-set-to-false-inserts-null-value-in-database.html)

needin4mation@gmail.com 10-11-2006 02:44 PM

Visible Property Set to False Inserts Null Value in Database
 
Hi, I have a employee and address table. the address table has an
addressid and and employeeid. I have two datagrids, an employee and
address.

The employee datagrid has a select. Clicking the select will product
the detail address grid.

If I hide the employeeid in the address table and set the column with
visible=false and update the row, I get a null in the database and
therefore cannot connect that employee to their address. If I set the
column to visible=true, then I can insert the data as expected.

I have searched, but must be searching on the wrong thing. I also have
tried setting the style class with visibility=hidden. This style hides
the data, but there is still a blank column showing.

What can I do? Thank you.


Siva M 10-12-2006 02:00 AM

Re: Visible Property Set to False Inserts Null Value in Database
 
I have not tried this before but can you keep the employee Id in in a
HiddenField and make it part of another column itself, say Address Line 1
(via template column) ? This way it wont be visible but still your Update
could work?

<needin4mation@gmail.com> wrote in message
news:1160577856.124751.82050@h48g2000cwc.googlegro ups.com...
Hi, I have a employee and address table. the address table has an
addressid and and employeeid. I have two datagrids, an employee and
address.

The employee datagrid has a select. Clicking the select will product
the detail address grid.

If I hide the employeeid in the address table and set the column with
visible=false and update the row, I get a null in the database and
therefore cannot connect that employee to their address. If I set the
column to visible=true, then I can insert the data as expected.

I have searched, but must be searching on the wrong thing. I also have
tried setting the style class with visibility=hidden. This style hides
the data, but there is still a blank column showing.

What can I do? Thank you.


needin4mation@gmail.com 10-12-2006 05:09 PM

Re: Visible Property Set to False Inserts Null Value in Database
 
I found that by using datakeynames I could put a comma separated list
of keys. This is by design for security, according to Microsoft. It
is also documented that if you want a field that retains its values in
postback (you have access to the array that holds the data) and want an
invisible field (visible=false), then you must you the datakeynames
property.

But I think a hidden control (not field) would work. I simply didn't
want to go that route because it felt like a "hack" instead of the
proper design methodology (no offense, I had considered this already
before your post and decided against it, unless there was no other
alternative.)

Thanks.


Siva M wrote:
> I have not tried this before but can you keep the employee Id in in a
> HiddenField and make it part of another column itself, say Address Line 1
> (via template column) ? This way it wont be visible but still your Update
> could work?
>
> <needin4mation@gmail.com> wrote in message
> news:1160577856.124751.82050@h48g2000cwc.googlegro ups.com...
> Hi, I have a employee and address table. the address table has an
> addressid and and employeeid. I have two datagrids, an employee and
> address.
>
> The employee datagrid has a select. Clicking the select will product
> the detail address grid.
>
> If I hide the employeeid in the address table and set the column with
> visible=false and update the row, I get a null in the database and
> therefore cannot connect that employee to their address. If I set the
> column to visible=true, then I can insert the data as expected.
>
> I have searched, but must be searching on the wrong thing. I also have
> tried setting the style class with visibility=hidden. This style hides
> the data, but there is still a blank column showing.
>
> What can I do? Thank you.




All times are GMT. The time now is 10:26 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.