This is a migrated thread and some comments may be shown as answers.

[Solved] MaskedTextField and GridMaskedColumnEditor

10 Answers 207 Views
Grid
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 28 Feb 2013, 10:29 PM

I have a column in my grid for entering a zip code and it is defined as:
                           
<telerik:GridMaskedColumn ConvertEmptyStringToNull="False" DataField="ZipCode" DataFormatString="{0:####-#####}"
    FilterControlAltText="Filter ZipCode column" HeaderText="Zip Code" Mask="#####-####"
    SortExpression="ZipCode" UniqueName="ZipCode" EmptyDataText="">
    <ColumnValidationSettings EnableRequiredFieldValidation="True">
        <RequiredFieldValidator ErrorMessage="* Required"></RequiredFieldValidator>
    </ColumnValidationSettings>
    <HeaderStyle Wrap="False" HorizontalAlign="Left" Width="70px" />
    <ItemStyle Width="100%" HorizontalAlign="Left"></ItemStyle>
</telerik:GridMaskedColumn>

I want to use the following control to edit it:

<telerik:GridMaskedColumnEditor runat="server" ID="txtGridEdit_Zip" MaskedTextBox-Width="90%">
    <MaskedTextBox runat="server" LabelCssClass="" LabelWidth="64px" DisplayMask="#####-####"
        Mask="#####-####" PromptChar=" " TextWithLiterals="-"></MaskedTextBox>
</telerik:GridMaskedColumnEditor>


If I leave the <MaskedTextBox> line in, it crashes out and won't let me save.  BUT, if I remove JUST the <MaskedTextBox> line, it works but then I have no way to adjust the styling of the editor.

Anyone else run into this or know of an example that works that you could point me to?

Thanks.

10 Answers, 1 is accepted

Sort by
0
J
Top achievements
Rank 1
answered on 04 Mar 2013, 06:12 PM
*crickets*
0
Kostadin
Telerik team
answered on 06 Mar 2013, 07:46 AM
Hello Juan,

This might be a bug and I will forward it to one of our developers for further investigation. I will let you know as soon as we have some progress on this matter.

Kind Regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
J
Top achievements
Rank 1
answered on 14 Mar 2013, 05:41 PM
Any info on this yet?
0
J
Top achievements
Rank 1
answered on 18 Mar 2013, 08:22 PM
Any info on this yet?
0
Accepted
Kostadin
Telerik team
answered on 19 Mar 2013, 01:51 PM
Hi Juan,

A fix will be available in Q1 2013 SP1.

Kind regards,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
J
Top achievements
Rank 1
answered on 19 Mar 2013, 02:07 PM
Ok.  Thanks.
0
J
Top achievements
Rank 1
answered on 19 Mar 2013, 02:07 PM
Any estimated release date for Q1 2013 SP1?
0
Kostadin
Telerik team
answered on 22 Mar 2013, 09:23 AM
Hi Juan,

Q1 2013 SP1 is scheduled for 3rd of April 2013.

Greetings,
Kostadin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
J
Top achievements
Rank 1
answered on 22 Mar 2013, 12:20 PM
OK.  Thanks.  :)
0
J
Top achievements
Rank 1
answered on 29 Mar 2013, 09:38 PM
I got around the issues I've had with the inline editing formatting and tab indexes by doing the following in my ItemDataBound event.

The masked edit text box now stays within the column's width.  I hate having tab indexes and widths hard coded but, it works.  Hopefully this helps anyone else experiencing this.

protected void grdAthletes_ItemDataBound(object sender, GridItemEventArgs e)
{
    Control ddlGenderSelector = null;
    Control ctrlFieldEditor = null;
    Control dtDoBEditor = null;
    Control ctrlFields = null;
 
    try
    {
        //Some controls don't load the values into the custom editor's automatically so force the values through
        if (e.Item.IsInEditMode)
        {
            ctrlFields = ((GridEditableItem)e.Item)["FirstName"].Controls[0];
            ((TextBox)ctrlFields).TabIndex = 50;
 
            ctrlFields = ((GridEditableItem)e.Item)["MiddleName"].Controls[0];
            ((TextBox)ctrlFields).TabIndex = 51;
 
            ctrlFields = ((GridEditableItem)e.Item)["LastName"].Controls[0];
            ((TextBox)ctrlFields).TabIndex = 52;
 
            ddlGenderSelector = e.Item.FindControl("ddlGender"); //Get the gender selection control
 
            //Load the current value for Gender into the column editor control
            if (ddlGenderSelector != null)
            {
                ((RadDropDownList)ddlGenderSelector).SelectedValue = ((DataRowView)e.Item.DataItem)[3].ToString();
                ((RadDropDownList)ddlGenderSelector).TabIndex = 53;
            }
 
            //Set the min/max dates for athletes date of birth
            dtDoBEditor = ((GridEditableItem)e.Item)["DoB"].Controls[0];
 
            if (dtDoBEditor != null)
            {
                ((RadDatePicker)dtDoBEditor).TabIndex = 54;
 
                if (string.Compare(_propsSettings.ProgramCode, "Y", true) == 0)
                {
                    ((RadDatePicker)dtDoBEditor).SelectedDate = DateTime.Now.AddYears(-_propsSettings.MaxAge);
                    ((RadDatePicker)dtDoBEditor).MinDate = DateTime.Now.AddYears(-_propsSettings.MaxAge);
                }
                else
                {
                    ((RadDatePicker)dtDoBEditor).SelectedDate = DateTime.Now.AddYears(-_propsSettings.MinAge);
                    ((RadDatePicker)dtDoBEditor).MinDate = DateTime.MinValue;
                }
 
                if (_propsSettings.MinAge > 0)
                    ((RadDatePicker)dtDoBEditor).MaxDate = DateTime.Now.AddYears(-_propsSettings.MinAge);
                else
                    ((RadDatePicker)dtDoBEditor).MaxDate = DateTime.MaxValue;
 
                //Try to load the currently entered date, if it falls out of the available range, then select the minimum value
                try
                { ((RadDatePicker)dtDoBEditor).SelectedDate = DateTime.Parse(((DataRowView)e.Item.DataItem)[7].ToString()); }
                catch
                { ((RadDatePicker)dtDoBEditor).SelectedDate = ((RadDatePicker)dtDoBEditor).MinDate; }
            }
 
            ctrlFields = ((GridEditableItem)e.Item)["ZipCode"].Controls[0];
            ((RadMaskedTextBox)ctrlFields).TabIndex = 55;
            ((RadMaskedTextBox)ctrlFields).Width = 64;
 
            ctrlFields = ((GridEditableItem)e.Item)["Email"].Controls[0];
            ((TextBox)ctrlFields).TabIndex = 56;
 
            ctrlFields = ((GridEditableItem)e.Item)["DeleteColumn"].Controls[0];
            ((ImageButton)ctrlFields).TabIndex = -1;
 
            //Get the editor for the first field and set focus to it
            ctrlFieldEditor = ((GridEditableItem)e.Item)["FirstName"].Controls[0];
             
            if (ctrlFieldEditor != null)
                ctrlFieldEditor.Focus();
        }
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.Print("Error: " + ex.ToString());
        Exceptions.ProcessModuleLoadException(this, ex);
    }
}
Tags
Grid
Asked by
J
Top achievements
Rank 1
Answers by
J
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or