Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How do I DataBind to a control when Textbox.visible=false

Reply
Thread Tools

How do I DataBind to a control when Textbox.visible=false

 
 
Rob Dob
Guest
Posts: n/a
 
      03-20-2006
Hi,

I'm not sure if I going about this the correct way.

I have some databound TextBox's displayed on a winform that are bound to my
BindingSource. When I make modifications to any of these textboxes and
then try to save these changes everything works fine. However I have a
requirement to programmically change the values of some of the other fields
which are part of this same BindingSource. My solution was to create some
additional TextBoxes and then change the property of those textboxes from
visible=true to visible=false, and then programmically change the Text
values of these controls from within my code. The problem is that none of
these changes are being updated for the controls where I have set Visible
=false.

How do I programmically change the values of some of the fields attached to
my BindingSource for which I don't wish to display on my winform, But I
still need the BindingSource to recognize these as changes and still treat
them the same as changes made manually to the other visible=true textboxes.

Thanks,



 
Reply With Quote
 
 
 
 
Eric Smith
Guest
Posts: n/a
 
      03-23-2006
I don't know if I understand your situation completely, but it seems like
you should be able to just change the fields directly on the underlying
object instead of trying to go through a TextBox.

I don't know if you're binding to some regular object or some other data
source, but when I had a class where changing one property also affected
other properties, I implemented INotifyPropertyChanged and fired the event
for all the properties that changed.

--Eric

"Rob Dob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I'm not sure if I going about this the correct way.
>
> I have some databound TextBox's displayed on a winform that are bound to
> my BindingSource. When I make modifications to any of these textboxes
> and then try to save these changes everything works fine. However I have
> a requirement to programmically change the values of some of the other
> fields which are part of this same BindingSource. My solution was to
> create some additional TextBoxes and then change the property of those
> textboxes from visible=true to visible=false, and then programmically
> change the Text values of these controls from within my code. The problem
> is that none of these changes are being updated for the controls where I
> have set Visible =false.
>
> How do I programmically change the values of some of the fields attached
> to my BindingSource for which I don't wish to display on my winform, But I
> still need the BindingSource to recognize these as changes and still treat
> them the same as changes made manually to the other visible=true
> textboxes.
>
> Thanks,
>
>
>



 
Reply With Quote
 
 
 
 
Rob Dob
Guest
Posts: n/a
 
      03-30-2006
Hi



Thank you for the reply...

">fields directly on the underlying object instead of trying to go through a
TextBox."

How do I go about doing this. within the BindingSource, the Dataset,
where?



"Eric Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed). ..
>I don't know if I understand your situation completely, but it seems like
>you should be able to just change the fields directly on the underlying
>object instead of trying to go through a TextBox.
>
> I don't know if you're binding to some regular object or some other data
> source, but when I had a class where changing one property also affected
> other properties, I implemented INotifyPropertyChanged and fired the event
> for all the properties that changed.
>
> --Eric



 
Reply With Quote
 
Ranko
Guest
Posts: n/a
 
      04-01-2006
Rob Dob wrote:
> Hi,
>
> I'm not sure if I going about this the correct way.
>
> I have some databound TextBox's displayed on a winform that are bound to my
> BindingSource. When I make modifications to any of these textboxes and
> then try to save these changes everything works fine. However I have a
> requirement to programmically change the values of some of the other fields
> which are part of this same BindingSource. My solution was to create some
> additional TextBoxes and then change the property of those textboxes from
> visible=true to visible=false, and then programmically change the Text
> values of these controls from within my code. The problem is that none of
> these changes are being updated for the controls where I have set Visible
> =false.
>
> How do I programmically change the values of some of the fields attached to
> my BindingSource for which I don't wish to display on my winform, But I
> still need the BindingSource to recognize these as changes and still treat
> them the same as changes made manually to the other visible=true textboxes.
>
> Thanks,
>
>
>

If I understand correctly your problem, you can try this(for example):
for untyped dataset:

Dim rowindex As Integer
rowindex = customersBindingSource.Position

customersDataset.Tables("Customers").Rows(rowindex )("LastName") = "Smith"

or for typed dataset:
customersDataset.Customers(rowindex).LastName = "Smith"

or
customersDataset.Customers(rowindex).LastName = LastNameTextBox.Text

 
Reply With Quote
 
Tatyana
Guest
Posts: n/a
 
      05-12-2006
Hello,

I had similar problem with this... I know it's better to work directly with DataSet Data but...

Well here is the answer :

http://fredrik.nsquared2.com/viewpost.aspx?PostID=201

Hope this helps,

Thank you,

Tatyana





"Rob Dob" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Hi,
>
> I'm not sure if I going about this the correct way.
>
> I have some databound TextBox's displayed on a winform that are bound to my
> BindingSource. When I make modifications to any of these textboxes and
> then try to save these changes everything works fine. However I have a
> requirement to programmically change the values of some of the other fields
> which are part of this same BindingSource. My solution was to create some
> additional TextBoxes and then change the property of those textboxes from
> visible=true to visible=false, and then programmically change the Text
> values of these controls from within my code. The problem is that none of
> these changes are being updated for the controls where I have set Visible
> =false.
>
> How do I programmically change the values of some of the fields attached to
> my BindingSource for which I don't wish to display on my winform, But I
> still need the BindingSource to recognize these as changes and still treat
> them the same as changes made manually to the other visible=true textboxes.
>
> Thanks,
>
>
>

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to DataBind droplist control in FormView Control EditItem mode =?Utf-8?B?eXVjaGFuZw==?= ASP .Net 0 04-15-2006 01:35 AM
Problem doing DataBind on a control within a DataList? Olav Tollefsen ASP .Net 2 12-29-2004 02:10 PM
Control.DataBind() question Bryce Budd ASP .Net 0 11-28-2004 03:34 AM
BUG in DataBind? After .DataBind there are more DataGrid Items than DataSet Rows! Michael ASP .Net Datagrid Control 0 12-29-2003 07:47 PM



Advertisments