Welcome Guest Search | Active Topics | Sign In | Register

MaskedEdit within Formview using Databind Options
M. van Berkel
Posted: Monday, February 18, 2008 1:50:58 AM
Rank: Member
Groups: Member

Joined: 1/11/2008
Posts: 16
Dear all,

I'm new to the EO tools, and so far, I like them a lot.
But I have a question about the use of MaskedEdit within a Formview.

At one of the pages I developed, I use a Formview to show and edit some tables.
The data is retrieved using a SqlDataSource command.
Within the Formview I use the command .....


<eo:MaskedEdit ID="Code" runat="server" PromtpChar="">
<eo:MaskedEditSegment IsRequired="true" Mask="&gt;LLLLL" Segment="Mask"
text="<%# Bind("Document_Code") %>'
/>
</eo:MaskedEdit>


The purpose is to show and edit the code of the document (Document_Code) using the standard Formview possibilities.

But.....
Building this page does not give any error.
Executing this pages returns an error with the following message :
The MaskedEditSegment control with a two-way databinding to field Document_Code must
have an ID.

Looking at the MaskedEditSegment options, I don see any ID present.


Could anyone help me with this.....
Kind regard,
Martin
eo_support
Posted: Monday, February 18, 2008 6:17:38 AM
Rank: Administration
Groups: Administration

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

You won't be able to do data binding an element that is not a control, which is the case of MaskedEditSegment. MaskedEditSegment is a segment of the MaskedEdit control. So in your case you need to set the Text on the MaskedEdit control, not MaskedEditSegment control.

Thanks
M. van Berkel
Posted: Monday, February 18, 2008 6:52:49 AM
Rank: Member
Groups: Member

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

I think I'm not looking at the right parts.....
but....
MaskedEditSegment has a proprty "text", and MaskedEdit does not......

Can you give an example of what you mean?

Kind regards
eo_support
Posted: Monday, February 18, 2008 7:08:10 AM
Rank: Administration
Groups: Administration

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

I believe MaskedEdit does have a Text property. It's just not showing it:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.MaskedEdit.Text.html

Thanks
M. van Berkel
Posted: Monday, February 18, 2008 7:37:54 AM
Rank: Member
Groups: Member

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

You're right.
There is a Text property. I was a little confused becouase it was not showing.

But again,
I 'm new to this and afraid I asked some stupid questions.

I did change the context into :

<eo:MaskedEdit ID="Code" runat="server" PromtpChar="" text="<%# Bind("Code") %>'>
<eo:MaskedEditSegment IsRequired="true" Mask="&gt;LLLLL" Segment="Mask" />
</eo:MaskedEdit>


I still doesn't get what I want.
The "code" field now looks like "____" but there is no value of code.

Thanks
eo_support
Posted: Monday, February 18, 2008 8:09:12 AM
Rank: Administration
Groups: Administration

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

The only thing that is not correct is Segment="Mask", it should be SegmentType="Mask". But other than that every looks correct.

When you see "_____", that generally means "Code" field is empty. So you want to verify if it is indeed empty. The easiest way to verify that is putting a Label next to the MaskedEdit:

<asp:Label id="testLabel" runat="server" Text='<%# Bind("Code") %>' />

If "Code" is not empty, you should get the value from this Label.

Thanks
M. van Berkel
Posted: Monday, February 18, 2008 8:25:04 AM
Rank: Member
Groups: Member

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

Mistake in typing over my code.
I did use "SegmentType="Mask". I only typed it wrong in this mail. Silenced

I used the "tooltip" property to verify the content of "code".
ToolTip='<%# Bind("Code") %>'
And it showed the expected values.......
So, it seems the values are not empty.
Brick wall
eo_support
Posted: Monday, February 18, 2008 8:27:29 AM
Rank: Administration
Groups: Administration

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

Can you type the value directly into Text property? For example, if the value ToolTip shows to you is "abc", try

<eo:MaskedEdit ID="Code" runat="server" PromtpChar="" text=""abc">

And see what happens.

Thanks
M. van Berkel
Posted: Monday, February 18, 2008 8:35:58 AM
Rank: Member
Groups: Member

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

I tried the following :
<eo:MaskedEdit ID="Code" runat="server" PromtpChar="" Text="abc">
(... i suppose single quotes -"- and not double quotes -""- )

This time I can't build the page and receive the following messages.

1) Validation (ASP.Net) : Attribute 'Text' is not a valid attribute of element "MaskedEdit"
2) The 'Text' property can not be set declaratively
Anxious
eo_support
Posted: Monday, February 18, 2008 8:47:25 AM
Rank: Administration
Groups: Administration

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

Yes. It's single quotes, not double quotes. :) And sorry I forgot that Text can not be set like that. You can set it this way:

Text = '<%# "abc" %>'

However I think I know what's causing the problem for you. Your mask is set to "LLLLL", which means five required letters. So any value that does not meet that requirement is rejected and regarded as blank. Since "L" is required, "abc" does not match "LLLLL" because "abc" is only three letters.

Thus change your "LLLLL" to "?????" should fix the problem.

Thanks

M. van Berkel
Posted: Monday, February 18, 2008 9:00:29 AM
Rank: Member
Groups: Member

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

EUREKA !!!!!!!!!!!!!!!!!!
:d/

You've got the solution.
The values in the database were indeed not 5 characters of length.
Changing then required LLLLL into ????? solved the problem.
Sh... it was a definition problem all the time.

THANKS for your great support.
eo_support
Posted: Monday, February 18, 2008 9:05:39 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Cool! Thanks for letting us know it works!


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.