Data Bound user control

Data Bound user control

Post by Klynt Klime » Fri, 28 Mar 2003 00:25:41



I have developed a user control inherited from a
CheckedListBox.

This control has a Text property which I have overridden
to accept and return a string representation of selected
checkboxes.

I then implemented Data Binding, and it seems to work
great translating string to checkboxes when READING from
the database (when moving between records, etc), but it
NEVER calls my code to translate checked boxes back into
string (Text {get} and ToString()) when departing record,
etc.

CONTROL
========
-- Data in string ABCD
A would be checked
B would be checked
C would be checked
D would be checked
E would NOT be checked

Is there something I need to do (trigger a "changed"
event or something) to indicate that the value has
changed and needs to be refreshed?

Thanks for any assistance,
Klynt Klimek

 
 
 

Data Bound user control

Post by Kathleen Dollar » Fri, 28 Mar 2003 10:34:04


Windows or Web?


Quote:> I have developed a user control inherited from a
> CheckedListBox.

> This control has a Text property which I have overridden
> to accept and return a string representation of selected
> checkboxes.

> I then implemented Data Binding, and it seems to work
> great translating string to checkboxes when READING from
> the database (when moving between records, etc), but it
> NEVER calls my code to translate checked boxes back into
> string (Text {get} and ToString()) when departing record,
> etc.

> CONTROL
> ========
> -- Data in string ABCD
> A would be checked
> B would be checked
> C would be checked
> D would be checked
> E would NOT be checked

> Is there something I need to do (trigger a "changed"
> event or something) to indicate that the value has
> changed and needs to be refreshed?

> Thanks for any assistance,
> Klynt Klimek


 
 
 

Data Bound user control

Post by Klynt Klime » Sat, 29 Mar 2003 00:40:26


Sorry, Windows.
This control is derived from
System.Windows.Forms.CheckedListBox

Thanks,
Klynt

>-----Original Message-----
>Windows or Web?



>> I have developed a user control inherited from a
>> CheckedListBox.

>> This control has a Text property which I have
overridden
>> to accept and return a string representation of
selected
>> checkboxes.

>> I then implemented Data Binding, and it seems to work
>> great translating string to checkboxes when READING
from
>> the database (when moving between records, etc), but it
>> NEVER calls my code to translate checked boxes back
into
>> string (Text {get} and ToString()) when departing
record,
>> etc.

>> CONTROL
>> ========
>> -- Data in string ABCD
>> A would be checked
>> B would be checked
>> C would be checked
>> D would be checked
>> E would NOT be checked

>> Is there something I need to do (trigger a "changed"
>> event or something) to indicate that the value has
>> changed and needs to be refreshed?

>> Thanks for any assistance,
>> Klynt Klimek

>.

 
 
 

Data Bound user control

Post by Kathleen Dollar » Mon, 31 Mar 2003 23:58:29


Klynt,

Did you get this solved?

Normally you'd use Format and Parse for massaging data back and forth to
databsae (be sure you don't let exceptions be thrown from Format and Parse).
You will probably need to boil this down toa code snippet and repost.

Kathleen


> Sorry, Windows.
> This control is derived from
> System.Windows.Forms.CheckedListBox

> Thanks,
> Klynt

> >-----Original Message-----
> >Windows or Web?



> >> I have developed a user control inherited from a
> >> CheckedListBox.

> >> This control has a Text property which I have
> overridden
> >> to accept and return a string representation of
> selected
> >> checkboxes.

> >> I then implemented Data Binding, and it seems to work
> >> great translating string to checkboxes when READING
> from
> >> the database (when moving between records, etc), but it
> >> NEVER calls my code to translate checked boxes back
> into
> >> string (Text {get} and ToString()) when departing
> record,
> >> etc.

> >> CONTROL
> >> ========
> >> -- Data in string ABCD
> >> A would be checked
> >> B would be checked
> >> C would be checked
> >> D would be checked
> >> E would NOT be checked

> >> Is there something I need to do (trigger a "changed"
> >> event or something) to indicate that the value has
> >> changed and needs to be refreshed?

> >> Thanks for any assistance,
> >> Klynt Klimek

> >.

 
 
 

1. Data binding DropDownList user control within other user controls

I have a user control with a DataList object on it.  Within the
<EditItemTemplate> I have a user control that is a special DropDownList
object.

<asp:DataList ID="usercontrol1" Runat="Server"
    OnEditCommand="dlEdit_Command"
    OnUpdateCommand="dlUpdate_Command"
    OnDeleteCommand="dlDelete_Command"
    OnCancelCommand="dlCancel_Command">

<ItemTemplate>
    <asp:Button ID="btnEdit" Runat="server" Text="Edit" CommandName="Edit"
CommandArgument='<%# Container.DataItem("ID") %>' />
    <asp:Label ID="lblItem" Runat="server" Text='<%#
Container.DataItem("Line") %>' />
</ItemTemplate>
<EditItemTemplate>
    <mytag:MyDropDownList ID="ddlDropDownList" Runat="server"
SelectedValue='<%# Container.DataItem("Value") %>' />
</EditItemTemplate>
</asp:DataList>

My MyDropDownList component on page load calls a method that takes the
SelectedValue and sets the SelectedIndex of the DropDownList object in
MyDropDownList object.  When I do this I receive "Object reference not set
to an instance of an object" errors.  I've run tests and have found that the
SelectedValue property doesn't have a value either.  It acts like the object
doesn't exist yet.

What do I have to do?  What is the firing order of methods when I perform a
databind on the datalist?
Am I at least close?

Thanks, Keith Geringer

2. Drawing a shaded rect over existing text without erasing it.

3. Data Binding within Data Bound Controls.

4. TextBox - How to change internal margins

5. How do I implement two-way data binding in a user-control

6. need help with adaptive filtering using gradient search

7. Data Binding a Web User Control

8. Apple Press Release - Announcing Performa line of computers

9. Extracting Data Binding expression from control and bind it.

10. Data binding control properties with custom binding expression

11. How to set data binding of treeView control to access data?

12. Binding Image Control In a Data List to an SQL Image data type

13. data binding of the html controls with data island in ASP.NET