Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Visible Property Set to False Inserts Null Value in Database

Reply
Thread Tools

Visible Property Set to False Inserts Null Value in Database

 
 
needin4mation@gmail.com
Guest
Posts: n/a
 
      10-11-2006
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.

 
Reply With Quote
 
 
 
 
Siva M
Guest
Posts: n/a
 
      10-12-2006
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?

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.

 
Reply With Quote
 
 
 
 
needin4mation@gmail.com
Guest
Posts: n/a
 
      10-12-2006
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?
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sys.ScriptLoadFailedException when switching control visible property from false within partial page render Andrew Jocelyn ASP .Net 6 02-08-2009 12:18 PM
Hide textbox / Make textbox not visible (NOT USING visible property) Jurjen de Groot ASP .Net Web Controls 0 05-19-2008 09:50 AM
Visible Property automatically getting to false even i set to true ? Mattias Sjögren ASP .Net 2 06-15-2007 11:17 AM
When I change field's visible property to false , error occurs . =?Utf-8?B?bWljaGFlbHM=?= ASP .Net 0 06-01-2006 09:19 AM
False positive, false intrusion, false alarm Nick Computer Security 3 04-26-2006 07:40 PM



Advertisments