We recently upgraded to version 8.3 and are experiencing problems with the WebMaskEdit control when used in an UltraWebGrid column and saving data with the RawText Mode. Please note that the same problem does not exist when using the control as a standard input control.
The definition we are using for the control is:
<igtxt:WebMaskEdit id="MaskPhoneNumbers" runat="server"
InputMask="(###) ###-####" Font-Bold="True"
>
When initializing the grid, we have:
grdContacts.Columns.FromKey(
"PhoneNumber").Hidden = false;
"PhoneNumber").HeaderText = "Phone Number";
"PhoneNumber").Type = Infragistics.WebUI.UltraWebGrid.ColumnType.Custom;
"PhoneNumber").EditorControlID = MaskPhoneNumbers.ID;
?MaskPhoneNumbers.RealText
"(40) 7-659"
As such, the RawText value being sent to the database is '407659'. Is there anyway to get the true RawText value? We have tried various approaches and the only method that will work is if we save the literals to the database which we do not want to do.
In version 6.3, this control worked as we needed it to.
Any help with this quirky behavior will be greatly appreciated.
Thanks and have a great day!
Hi,
The RealText property, which appears in aspx, represents value which is sent to client in internal format. It is not related to the string used for get/setValue (used by grid). That property was not designed for public access. If editor is stand alone (not grid editor), then public properties Text and Value should be used.
If data, which are used to initialize editor and get value after end edit mode, contain literal characters, then the DataMode should be set to RawTextWithLiterals, or RawTextWithRequiredPromptsAndLiterals, or AllText depending on requirements of application.
Thanks for your reply. Saving the literals to the database is not what we need which I gather is what would happen if using RawTextWithLiterals. Can we get the raw text by replacing the literals when actually inserting into the database? What would happen when retrieving that value back into the grid with the mask?
For example: Our mask is: (###) ###-#### GridValue: (999) 999-9999 Database value: GridValue.Replace("(","").Replace(")","").Replace(" ","").Replace("-","")
I haven't had the opportunity to test this but would like your opinion on whether or not you think it would work.
The WebMaskEdit has property RawText. That can be used to get/set value without literals regardless of the DataMode value. That is probably what you need.
Sorry, but I don't see a property of RawText other than as a value for DataMode. How would it be used?
Thanks!
That property is not serializable, so it can not be accessed within aspx. If should see it and modify within Properties at visual design. But it is really a run-time property. Example to use:
protected void Page_Load(object sender, EventArgs e){ string rawText = this.WebMaskEdit1.RawText;}
Hi Viktor,
on several pages in my project there is an Ajax populating the Counties dropdown, called on OnTextChanged of an asp:TextBox.
Is there a way to do the same thing with a WebMaskEdit? One of the pages in the project uses WebMaskEdit for a zipcode.
<
asp:UpdatePanel ID="UpdatePanel1" runat
="server">
<ContentTemplate
<asp:TextBox ID="txtHQZip" runat="server" MaxLength="5" Width="60px" OnTextChanged="txtHQZip_TextChanged" AutoPostBack="true" />
<asp:DropDownList ID="ddlCounty" runat="server" onChange="AssignToTextBox();"></asp:DropDownList
</ContentTemplate
</asp:UpdatePanel>
WebMaskEdit has AutoPostBack property identical to TextBox. It has server event ValueChanged as well. So, you may
aspx:
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" ontextchanged="TextBox1_TextChanged"></asp:TextBox> <igtxt:WebMaskEdit ID="WebMaskEdit1" runat="server" AutoPostBack="True" onvaluechange="WebMaskEdit1_ValueChange"></igtxt:WebMaskEdit> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate></asp:UpdatePanel>
aspx.cs:
protected void TextBox1_TextChanged(object sender, EventArgs e){ this.Label1.Text += ":TextBox="+this.TextBox1.Text;}protected void WebMaskEdit1_ValueChange(object sender, Infragistics.WebUI.WebDataInput.ValueChangeEventArgs e){ this.Label1.Text += ":MaskEdit="+this.WebMaskEdit1.Value;}
Notes:WebMaskEdit also has various ClientSideEvents, so, you may process them and avoid AutoPostBack.
If you use WebMaskEditor, then it has more options for AutoPostBack, they are located in the AutoPostBackFlags property.
Yes, conflicts between GAC and run time dlls is "special" feature of dot-net...Glad you fixed that.
I also recommend once in awhile close all instances of VisualStudio and remove all files fromC:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
Viktor,
after rebooting my workstation the WebMaskEdit is posting back asynchronously each time, not just the first one. Thank you for your support.
the problem is that the async postback fires only once after the page is loaded, the next ones aren't hapenning
I tried DropDownList instead of TextBox, and it worked same way. Please try to debug by commenting line BindCounty and put a break point instead. Check if it runs and break point is hit every time on async postback from mask editor. If it does not have difference, then try to replace WebMaskEdit by TextBox with similar configuration. If TextBox will work, but WebMaskEdit fails, then the only option I can suggest, is to build a simple sample which can be used to reproduce that issue and submit a request at http://es.infragistics.com/support/ask-for-help.aspx
I agree to it being strange. This is the code, that executes only on the first attempt to fill the ddlCounty:
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <igtxt:WebMaskEdit ID="groupZip" CssClass="textBoxEdit" InputMask="#####" Width="40px" runat="server" AutoPostBack="true" onvaluechange="groupZip_ValueChange" ></igtxt:WebMaskEdit> <asp:DropDownList ID="ddlCounty" runat="server"></asp:DropDownList> </ContentTemplate> </asp:UpdatePanel>
protected void groupZip_ValueChange(object sender, Infragistics.WebUI.WebDataInput.ValueChangeEventArgs e) { BindCounty(groupZip.Text); }