Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a Business Object
Message
De
22/11/2004 13:27:45
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00963260
Message ID:
00963574
Vues:
8
Gerard,

Well, you're looking in the right place. There can't be too much stuff in the DataBindings on the Property Sheet. If you expand the node, you'll see Advanced, Tag and Text. If you click on Text (which is the TextBox property that you want to bind to), you'll see the DataSets that you dragged onto your form. Expand that and you'll see the tables and columns in that DataSet. Click on a column and you'll bind that TextBox to that Column in that DataTable in that DataSet.

If you look at the code that gets generated when you do that, you'll see that it's more or less the same as the code I posted earlier.

~~Bonnie



>Hi Bonnie.
>I'll rephrase and hopefully make myself a little clearer.
>
>In VFP, there is a ControlSource proerty for TextBoxes. To bind a Text Box to a field, all you have to do is enter into this Property the name of the field, e,g. Thisform.ObjmemVar.MyField or MyAlias.MyField.This can be done on the Form in design mode.
>
>
>I'm wondering what is the equivalent in dot net. When I go into a TextBox properties, and databindings ,there seems to be a whole pile of stuff in there and I am not clear which item to select to bind the Dataset current record's field to the textBox on the form.
>
>Regards,
>
>Gerard
>
>
>>Gerard,
>>
>>>Can this be done visually ?
>>
>>Can what be done visually? DataBinding the TextBoxes? Sure, if you've dragged your DataSet visually onto your Form. Look for DataBinding on the Property Sheet ... it will be the first thing at the top of the Property Sheet. This won't work if you haven't dragged the DataSet visually though. I hardly ever do this ... I almost always DataBind programmatically.
>>
>>~~Bonnie
>>
>>
>>>Hi Bonnie.. thanks for your reply.
>>>
>>>Can this be done visually ?
>>>(In VFP terms , what would be the equivalent of the ControlSource property ?)
>>>
>>>My grid is bound to a Dataset
>>>
>>>Regards,
>>>
>>>Gerard
>>>
>>>
>>>
>>>>Hi Gerard,
>>>>
>>>>Number One is your answer. Once you bind your text boxes to the same Table that the grid is bound to, the values in the text boxes should be from whatever row you're on in the grid. So, something like this:
>>>>
>>>>this.MyTextBox1.DataBindings.Add("Text", MyDataSet.MyGridTable, "MyColumn1");
>>>>this.MyTextBox2.DataBindings.Add("Text", MyDataSet.MyGridTable, "MyColumn2");
>>>>
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>>>Hi.
>>>>>
>>>>>I've just created my forst Business Object in .Net which stores all records into a DataSet, which is displaying nicely in a grid.
>>>>>
>>>>>I now want to amend 'One' of the records in the grid, and am wondering whats the best way to tackle this. (I would prefer to do this in a separate 'Edit' Tab on the page rather than in the grid itself)
>>>>>
>>>>>I reckon my options are:
>>>>>
>>>>>1. Is there an automatic way that I can 'Simple' bind the fields of the 'current' record in the existing dataset (I dont know if this can be done or how to do it)
>>>>>
>>>>>2. Copy the particular record I want to amend out to another 'dataset' and use 'Simple Data Binding' to bind to each field in this second dataset
>>>>>
>>>>>3. Dynamically Create Properties of my Business Object which would be the field names of the dataset, and then bind these to the text boxes etc.
>>>>>
>>>>>Option no. 3 would seem to me to be the most 'Object Oriented' but I am open to any suggestions on how to accomplish the best result.
>>>>>
>>>>>Regards,
>>>>>
>>>>>Gerard
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform