Welcome Guest Search | Active Topics | Sign In | Register

Maskedit and binding Data Options
M. van Berkel
Posted: Sunday, May 25, 2008 8:53:26 AM
Rank: Member
Groups: Member

Joined: 1/11/2008
Posts: 16
Hello,

I have a little question about databinding winthin the use of a Maskedit control.

I want to use the Maskedit to verify a dutch postal code (Postcode).
On the form I use a Formview to display the content.

What will be the best way to do this.

I now use the following sentence :

<eo:MaskedEdit ID="Postcode" CssClass="Tekst_Standaard" runat="server" PromptChar="" Width="60px" Enabled="true" Hint='<%# Bind("Medewerker_Postcode") %>'>
<eo:MaskedEditSegment IsRequired="True" Mask="0000 &gt;LL" SegmentType="Mask" />
</eo:MaskedEdit>


But, the databinding is not working and the new postcode is not stored.

Kind regards
Martin



eo_support
Posted: Sunday, May 25, 2008 12:24:19 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

I am not sure what you mean by "the new postcode is not stored". If you mean that the new postcode entered by the user is not stored into the database, then that is normal. The MaskedEdit control never saves anything back to your database. You will need to get what user entered from the control through its Text property and then save it back to the database by yourself.

We tested MaskedEdit control with data binding and it seems to work fine. Our test code is as follow:

Code: HTML/ASPX
<asp:Repeater Runat="server" id="Repeater1">
    <ItemTemplate>
        <eo:MaskedEdit ID="Postcode" CssClass="Tekst_Standaard" runat="server" PromptChar="" Width="60px" Enabled="true" Hint='<%# "test" %>'>
            <eo:MaskedEditSegment IsRequired="True" Mask="0000 &gt;LL" SegmentType="Mask" />
        </eo:MaskedEdit>
    </ItemTemplate>
</asp:Repeater>


Code: C#
private void Page_Load(object sender, System.EventArgs e)
{
    Repeater1.DataSource = new object[3];
    Repeater1.DataBind();
}


Thanks
M. van Berkel
Posted: Sunday, May 25, 2008 11:53:37 PM
Rank: Member
Groups: Member

Joined: 1/11/2008
Posts: 16
Hi,

Sorry, I wasn't clear enough in defining my problem, I think.

I have a fully working appplication (including data acces by DAL, BBL, ODS, SqlDataSource, etc).
Within this application I enter adress information of clients.
I enter the data thru a FormView using Textbox controls.
For example the Postalcode (like the one below) by using TextBoxes :

<asp:TextBox ID="Postcode" runat="server" Text='<%# Bind("PostalCode") %>' >
</asp:TextBox>

I bind the data using the <% %> controls.
Like I said, this is fully operational.
The only problem is that there is no validation at entering time, so I want to use a MaskEdit.


So, I want to replace the TextBox by a control of Essential Object, the MaskEdit.
The one I'm using is like :

<eo:MaskedEdit ID="Postcode" runat="server" PromptChar="" Hint='<%# "PostalCode" %>'>
<eo:MaskedEditSegment IsRequired="True" Mask="0000 &gt;LL" SegmentType="Mask" />
</eo:MaskedEdit>


Now, The MaskEdit control does the right validation of input, but I seem to be losing the information at update time in the database.
I noticed that there is no "Text" availible at the MaskEdit, so I'm using the "Hint".

I hope the problem is clear now.

Kind regards,
Martin
M. van Berkel
Posted: Monday, May 26, 2008 12:22:21 AM
Rank: Member
Groups: Member

Joined: 1/11/2008
Posts: 16
Hi,

The problem is solved.

Although in editing the source, there is no "Text" element availeble, I did put a "Text" element in the MaskEdit control..... and it is working.

It was a little bit confusing, but its working again.

Thanks,


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.