Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
139 views


Hi Everyone

I am having trouble with a RequiredField Validator for a ComboBox in Edit Form.

This is the scenario:

I have a grid with 3 columns:
1 TemplateColumn with a ComboBox as its EditItemTemplate
2 GridNumericColumns

 

I’ve placed OnBlur and OnFocus events on the two NumericColumnEditors.

I’ve Placed a Compare Field Validator for the comboBox

I’ve also disabled the ComboBox when it is in the Edit form.

 

Now, this works fine when I am in the Insert Form but when I hit the edit command  I get this error:

 

htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.


This is the JSCode:


var oldValue;
function Focus(sender, eventArgs)
{
     oldValue = sender.get_value();
}
              
function Blur (sender, eventArgs)
{
    if ( sender.get_value() < 0)
    {
         radalert('El valor no puede ser negativo',200,100,'Alerta');
         sender.set_value(oldValue);
    }                                    
}

Markup:

<Columns>
      
    <telerik:GridTemplateColumn UniqueName="LINEA" HeaderText="Linea ISA" AllowFiltering="False">
        <ItemTemplate>
            <asp:Label ID="LIN" runat="server" Width="80px">
                   <%# DataBinder.Eval(Container.DataItem, "LINEA")%>
            </asp:Label>
        </ItemTemplate>
        <EditItemTemplate>
            <telerik:RadComboBox DataTextField="EQUIPO" DataValueField="EQUIPO" EnableLoadOnDemand="True"
                ID="RadCmbBx_Linea" runat="server" MarkFirstMatch="True" OnSelectedIndexChanged="RadCmbBx_Linea_SelectedIndexChanged"
                AutoPostBack="true">
            </telerik:RadComboBox>
            <asp:CompareValidator ValueToCompare="Select..." Operator="NotEqual" ControlToValidate="RadCmbBx_Linea"
                ErrorMessage="You must select a city!" runat="server" ID="Comparevalidator1" />
        </EditItemTemplate>
    </telerik:GridTemplateColumn>
      
    <telerik:GridNumericColumn DataField="ENERGIA_ACTIVA_HOY" UniqueName="ENERGIA_ACTIVA_HOY" HeaderText="Energia Hoy" />
      
    <telerik:GridNumericColumn DataField="ENERGIA_REACTIVA_HOY" UniqueName="ENERGIA_REACTIVA_HOY" HeaderText="Energia Hoy ReActiva" />
      
</Columns>

CodeBehind:

protected void RgridLineasISA_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && (e.Item.IsInEditMode))
    {
        RadComboBox comboLinea = e.Item.FindControl("RadCmbBx_Linea") as RadComboBox;
        comboLinea.DataSource = new OES.Business.Equipo().ListLineasISA(); 
        comboLinea.DataBind();
        comboLinea.Items.Insert(0, new RadComboBoxItem("Select..."));
  
        if ((e.Item as GridEditableItem).IsInEditMode && (e.Item as GridEditableItem).IsDataBound && e.Item.ItemIndex != -1)
        {
            comboLinea.SelectedValue = ((OES_LineasISA)e.Item.DataItem).LINEA.ToString();
            comboLinea.Enabled = false;
    }
}
  
    protected void RgridLineasISA_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && (e.Item.IsInEditMode))
        {
            GridNumericColumnEditor editorEnerActHoy = (GridNumericColumnEditor)e.Item.EditManager.GetColumnEditor("ENERGIA_ACTIVA_HOY");
            editorEnerActHoy.NumericTextBox.ClientEvents.OnBlur = "Blur";
            editorEnerActHoy.NumericTextBox.ClientEvents.OnFocus = "Focus";
  
            GridNumericColumnEditor editorEnerReactHoy = (GridNumericColumnEditor)e.Item.EditManager.GetColumnEditor("ENERGIA_REACTIVA_HOY");
            editorEnerReactHoy.NumericTextBox.ClientEvents.OnBlur = "Blur";
            editorEnerReactHoy.NumericTextBox.ClientEvents.OnFocus = "Focus";
        }
    }


The exception is due to the CompareValidator, if I remove it then it works, but I need it in order to validate the ComboBox selected item.

How can I get rid of this execption?

Thanks!
Miguel

Nikolay Rusev
Telerik team
 answered on 23 Dec 2010
1 answer
99 views
Hi,

I wonder if there is anyone who knows how to detect an IFrame breakout condition.

Under the example http://demos.telerik.com/aspnet-ajax/window/examples/default/defaultcs.aspx :

If one selects 'Open New Window' with a URL that has IFRAME breakout detection then the site opens in the main window instead of the newly created RadWindow. I understand there isn't really a way to prevent this however I'm wondering if there's a way to detect it and prevent the main page loading this URL. I would prefer an alert message that tells the user one will navigate away from the page.

The javascript below is not the ideal solution as this confirmation is called on every page refresh, back button etc.
window.onbeforeunload = function () {
       return "This will take you away?";
}

An example of a site with IFRAME breakout detection is  www.k1664.com



Thanks
Georgi Tunev
Telerik team
 answered on 23 Dec 2010
1 answer
88 views
I have the following code
<table cellpadding="0" cellspacing="0" width="100%">
        <tr>
              
           <td>
           <asp:Panel ID="ListViewPanel1" runat="server">
        <telerik:RadListView ID="RadListView1" Width="100%" AllowPaging="True" runat="server" PageSize="9" 
            AllowSorting="true" OnNeedDataSource="RadListView1_NeedDataSource" ItemPlaceholderID="ProductsHolder"
           >
            <LayoutTemplate>
                <fieldset  id="FieldSet1" style="border:none;  padding-left :30px;">
                 
                <asp:Panel ID="ProductsHolder" runat="server" />
                
                </fieldset>
            </LayoutTemplate>
            <ItemTemplate>
             <div class="category">
          <table cellpadding="0" cellspacing="0"  >
                        <tr><td>
                <a  style='cursor:pointer;' href='<%# DetermineLink(Eval("id"), Eval("center"))%>'>
                                  <img src='<%#DetermineImage(Eval("id"), Eval("center"))%>'  border='0' hspace='0' width='<%#Eval("w")%>' height='<%#Eval("h")%>' align="middle"/>
                                  </a>
  
                        </td></tr>
                        <tr>
                              
                            <td >
                                <%#Mid(Eval("Title"), 1, 25)%>
                            </td>
                        </tr>
                        <tr><td><br /></td></tr>
                    </table>
            </div>
            </ItemTemplate>
        </telerik:RadListView>
    </asp:Panel>
           </td>
           <td valign="middle" align="center" >
 
              <telerik:RadDataPager ID="RadDataPager1" runat="server" 
                   PagedControlID="RadListView1"  PageSize="9" Height="430px" 
                   Width="16px"   >
                    
                    <Fields >
                  
                    <telerik:RadDataPagerSliderField  SliderDragText="" SliderDecreaseText="" SliderIncreaseText=""  SliderOrientation ="Vertical"  />
   
                    </Fields>
                    
                </telerik:RadDataPager>
                 
            </td>
              
        </tr>
    </table>

I am  using RadDataPagerSliderField   with this css style

.RadDataPager_Default
{
    border:none;
    background-color:Transparent;
    width:5px;
     padding-left : 45px;
     min-height:200px;
}
  
  
  
.RadDataPager_Default  .rdpSliderLabel
{
        display: none ;
        
}
.RadSlider_Default .rslTrack
        {
            border-color: #b9b9b9 #939393 #939393 #b9b9b9;
              
            height: 400px !important;
        }
.RadSlider .rslVertical .rslIncrease 
        {
            bottom: -250px !important;
        }
  
.RadSlider_Default .rslVertical a.rslHandle
{
    
      
    background-image:url('Slider/HandlesVertical.gif');
}
  
.RadSlider_Default .rslVertical a.rslDraghandle
{
     
    background:url('Slider/DragVerticalHandleRight.gif') no-repeat;
}


On my computer i am able to slide the navigation bar on click on the horizontal arrow it will go to the next page. But on other computer they can only navigate using the up and down arrows, they cant slide it. What is the reason?I need it to work on all pcs
Pavlina
Telerik team
 answered on 23 Dec 2010
1 answer
121 views
Hi everybody,

Hope you can help me... i'm going crazy with this one :S

I use a GridTemplateColumn defined as  DataType="System.DateTime". When I use isNull option in the grid filter, returns me the error: 
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: String was not recognized as a valid DateTime.

How can I solve this problem? Can anyone help me?
Thanks,
Nuno
Princy
Top achievements
Rank 2
 answered on 23 Dec 2010
1 answer
58 views
After setting content in a RadEditor control through client side script and then clicking inside the RadEditor content area, I have to type additional text before the Back or Delete buttons will work. Anyone else seen this behavior?
Rumen
Telerik team
 answered on 23 Dec 2010
1 answer
106 views
I'm finding that the RadListBox doesn't play well with other controls that utilize layering.  Internally we use a jQuery menu that cascades down on MouseOver.  We also use the AJAX Toolkit Calendar control that overlays a calendar.  In both instances, the menu and the calendar control go over everything on the page (other ASP.NET controls, other Telerik Controls include RadGrids) but the RadListBox stays as the top most item and blocks the menu and calendar control.  I've tried manually setting the z-index of the RadListBox but it doesn't seem to have any impact.  It's something that's set within one of the default styles because if I set EnableEmbeddedBaseStylesheet and EnableEmbeddedSkins both to false then the issue goes away.  Of course so then does the nice visual of the RadListBox.  I've tried overriding the styles using the StyleBuilder.  I've verified that there's nothing within these Styles that cause the issue.  It seems to be something within the RadListBox style but I haven't examined that particular style to try to find out what.  Any ideas or suggestions on overriding that particular style or suggestions on how to prevent that one style from being included while still allowing me customize other aspects of the styling?
Simon
Telerik team
 answered on 23 Dec 2010
1 answer
291 views
Hi,

I would like to set a RadToolTip from the code behind to a textbox.
I have a property named ErrorDescription, when i fill this property i would like to set the tooltip text property and whatever i need, so,
at last when the textbox will get a focus the tooltip will be display.

I don't want to use any javascript or html code. only from the code behind.
One more important thing, i don't want any postback.

Is it possible?


Thank you.
Svetlina Anati
Telerik team
 answered on 23 Dec 2010
3 answers
132 views
I am using the Ajaxmanager for a control.  When I added partial caching to the control, I got some issues with the Rad Controls.  See the attched file.  Is there any way around this.
Veli
Telerik team
 answered on 23 Dec 2010
1 answer
205 views
Hi,

I have using Nested Template into RadGrid. but scrolling not working for me. i checked all the ways. but still it's not working.

Here the code what i am using. but i remove the nested template scrolling working fine. can anyone give me suggestion for this one.

I want more important that one.

i have two questions.

1. how to get scrolling when using nestedTemplate into radgrid.
2. how to automatically expand nestedtemplate when have at least one record. otherwise how to disable nested template.

Hi this is very very urgent. please help to me.

Here i send code and screen shot.

  <asp:View ID="vwEarningslist" runat="server">
                   <telerik:RadGrid ID="rgEarningslist" runat="server" DataSourceID="sdsEarningslist" AutoGenerateColumns="False"  AllowSorting="True" GridLines="None" Width="740px" ShowStatusBar="true">
                        
                        <ExportSettings  ExportOnlyData="true" IgnorePaging="True" OpenInNewWindow="true">
                        </ExportSettings>                
                        
                        
                        <MasterTableView  AllowMultiColumnSorting="true" DataKeyNames="CLIENTEARNINGID" Width="100%" CommandItemDisplay="Top">
                            <CommandItemSettings ShowExportToPdfButton="true" ShowExportToCsvButton="false"
                                ShowExportToExcelButton="True" ShowExportToWordButton="false"
                                ShowAddNewRecordButton="False"/>
                            <ParentTableRelation>
                                        <telerik:GridRelationFields DetailKeyField="client_earning_id"  MasterKeyField="CLIENTEARNINGID" />
                                    </ParentTableRelation>
                                    <Columns>     
                                        <telerik:GridBoundColumn SortExpression="EARNINGCODE" HeaderText="Code" DataField="EARNINGCODE"  Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="EARNINGDESCRIPTION" HeaderText="Description" DataField="EARNINGDESCRIPTION"  Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                     <telerik:GridBoundColumn SortExpression="TIMECLOCKCODE" HeaderText="Time Clock Code" DataField="TIMECLOCKCODE" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn SortExpression="FREQUENCY" HeaderText="Frequency" DataField="FREQUENCY" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                       <telerik:GridBoundColumn SortExpression="GLNO" HeaderText="GL Number" DataField="GLNO" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn SortExpression="DATATYPE" HeaderText="Data Type" DataField="DATATYPE" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                         <telerik:GridBoundColumn SortExpression="UNITRATE" HeaderText="Unit Rate" DataField="UNITRATE" Resizable="True" Reorderable="True"  HeaderButtonType="TextButton"></telerik:GridBoundColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Taxable?"  ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Exclude WC?" ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Employer Contribution?"  ></telerik:GridCheckBoxColumn>
                                         <telerik:GridCheckBoxColumn  HeaderText="Employee Contribution?"  ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Exclude Savings?"  ></telerik:GridCheckBoxColumn>                                            
                                           <telerik:GridCheckBoxColumn  HeaderText="Include In AddI Check?" ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="Exclude From Net Calc?" ></telerik:GridCheckBoxColumn>
                                           <telerik:GridCheckBoxColumn  HeaderText="In/Out?" ></telerik:GridCheckBoxColumn>
                                     </Columns>
                                    <NestedViewTemplate>
                                        <telerik:RadGrid ID="rgEarningChildList" runat="server" Width="675px" DataSourceID="sdsTaxDescription"
                                            AutoGenerateColumns="false" AllowSorting="true" >
                                            <MasterTableView Width="95%" DataKeyNames="client_earning_id"  HeaderStyle-VerticalAlign="Middle">
                                                <NoRecordsTemplate>
                                                    <div align="center" >
                                                        There are no records to display</div>
                                                </NoRecordsTemplate>
                                                <Columns>
                                                     <telerik:GridBoundColumn HeaderText="Location" DataField="REPLOC"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="Worksite" DataField="WORKSITE"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="Cost Center" DataField="COSTCENTER"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="GL Number" DataField="GLNUM"></telerik:GridBoundColumn>
                                                     <telerik:GridBoundColumn HeaderText="Description" DataField="GLDESCRIPTION"></telerik:GridBoundColumn>
                                                </Columns>
                                            </MasterTableView>
                                            <HeaderStyle Wrap="false" />                   
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="true"/>
                        </ClientSettings>
                                        </telerik:RadGrid>
                                    </NestedViewTemplate>
                        </MasterTableView>     
                        <HeaderStyle Wrap="false" />                   
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="true"/>
                        </ClientSettings>
                    </telerik:RadGrid>
                             
            </asp:View>

Thanks in Advance,
Dhamu.
Princy
Top achievements
Rank 2
 answered on 23 Dec 2010
1 answer
89 views
I have build a solution using the AdvanceForm  example and everything is working fine,
I group the scheduler by resource insert appointment, custom it work perfect.

then I tried to add some limitation and handle the event of appointment Inserted
here the problem starts,
the resource are not being passed as part of the e.Appointment... and I get some attribute with I don't expect to have at all.

the data is being save and load from DB OK,

can you advise?
I'm using 2010 Q1

Mickey
Mickey
Top achievements
Rank 1
 answered on 23 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?