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

Having an Issue with RadInputManager with Grid

2 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan Lege
Top achievements
Rank 1
Ryan Lege asked on 04 Nov 2010, 11:41 AM
It is strange, I followed the example online and it is not functioning as expected. I have three textboxes when GRid is in edit mode and two of them are supposed to be currency and the other just plain text. But the RadInputManager is forcing the Plain textbox to be currency as well. This even after the datatype was set to string. Help please

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 04 Nov 2010, 03:09 PM
Hello.Benjamin,

I have tried the same scenario and it worked for me. Here is the code that I tried.

ASPX:
<telerik:RadInputManager ID="RadInputManager1" runat="server">
        <telerik:TextBoxSetting BehaviorID="TextBoxBehavior1" InitializeOnClient="false">
        </telerik:TextBoxSetting>
        <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior1" InitializeOnClient="false"
                Type="Currency">
        </telerik:NumericTextBoxSetting>
        <telerik:NumericTextBoxSetting BehaviorID="NumericBehavior2" InitializeOnClient="false"
                Type="Currency" DecimalDigits="2">
         </telerik:NumericTextBoxSetting>
 </telerik:RadInputManager>
 
<telerik:RadGrid ID="RadGrid1"......
 <EditFormSettings EditFormType="Template">
       <FormTemplate>
           <asp:TextBox ID="TextBox1" runat="server">
           </asp:TextBox>
           <asp:TextBox ID="TextBox2" runat="server">
          </asp:TextBox>
          <asp:TextBox ID="TextBox3" runat="server">
          </asp:TextBox>
     </FormTemplate>
  </EditFormSettings>
................
 </telerik:RadGrid>

C#
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
   {
       if (e.Item is GridEditableItem && e.Item.IsInEditMode)
       {
           GridEditFormItem editedItem = e.Item as GridEditFormItem;
           TextBox txt1 = editedItem.FindControl("TextBox2") as TextBox;
           NumericTextBoxSetting numericSetting = (NumericTextBoxSetting)RadInputManager1.GetSettingByBehaviorID("NumericBehavior1");
           numericSetting.TargetControls.Add(new TargetInput(txt1.UniqueID, true));
           TextBox txt2 = editedItem.FindControl("TextBox3") as TextBox;
           NumericTextBoxSetting textBoxSetting = (NumericTextBoxSetting)RadInputManager1.GetSettingByBehaviorID("NumericBehavior2");
           textBoxSetting.TargetControls.Add(new TargetInput(txt2.UniqueID, true));
           TextBox txt3 = editedItem.FindControl("TextBox1") as TextBox;
           TextBoxSetting regExpSetting = (TextBoxSetting)RadInputManager1.GetSettingByBehaviorID("TextBoxBehavior1");
           regExpSetting.TargetControls.Add(new TargetInput(txt3.UniqueID, true));
       }
   }

Check whether you have added the TextBoxSetting for the TextBox mistakenly. Please paste your code, if it doesn't helps.


Thanks,
Princy
0
Ryan Lege
Top achievements
Rank 1
answered on 04 Nov 2010, 04:50 PM
PERFECT! It works! Have no idea why this was not in any of the examples they have, or why we would need to do this programatically in the first place. Whatever. At least it works. Thanks
Tags
Grid
Asked by
Ryan Lege
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ryan Lege
Top achievements
Rank 1
Share this question
or