Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
148 views
Dear Telerik,

We are experiencing a strange thing with the RadGrid. We have set up a RadGrid clientside, all clientside. Paging, Adding and Deleting are done clientside.

What we come across is that every second time we Delete a row(by calling the deleteCustomer function) the  masterTable.deleteSelectedItems(); is not executed. But the console.log just above it is executed so it makes it too that function each time you want to delete an item.
The basic idea of deleting these items is that when a row is selected, an javascript array is filled with IDs and when the deleteCustomer function is executed, it fires an ajax call to the webservice to do database updates. And after waiting for the result to come back, it deletes the row from the grid.

Is there a bug in the RadGrid that makes it unavailable for a small time or are we not implementing this correctly?
I have put the RadGrid and Jquery code beneath.

By the way, we also used masterTable.rebind function instead of the deleteSelectedItems but that has the same effect.

Thank you for your time.

Vincent

<telerik:RadGrid ID="AudienceRecipientsGrid" runat="server" Width="695" AllowPaging="True" PageSize="15" AutoGenerateColumns="false" AllowMultiRowSelection="true" >
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
    <MasterTableView TableLayout="Fixed" DataKeyNames="CustomerID" ClientDataKeyNames="CustomerID">
        <Columns>
            <telerik:GridBoundColumn DataField="CustomerID" DataType="System.Int32" FilterControlAltText="Filter CustomerID column" HeaderText="CustomerID" SortExpression="CustomerID" UniqueName="CustomerID" Visible="False" ReadOnly="True"></telerik:GridBoundColumn>
            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="6%" ItemStyle-Width="6%">
                    <HeaderStyle Width="6%"></HeaderStyle>
                    <ItemStyle Width="6%"></ItemStyle>
                </telerik:GridClientSelectColumn>
            <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="Voornaam" SortExpression="Name" UniqueName="Name"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SurName" FilterControlAltText="Filter SurName column" HeaderText="Achternaam" SortExpression="SurName" UniqueName="SurName"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Email" FilterControlAltText="Filter Email column" HeaderText="E-mail" SortExpression="Email" UniqueName="Email"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="joindate" DataType="System.DateTime" FilterControlAltText="Filter joindate column" HeaderText="Inschrijfdatum" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" UniqueName="joindate" ReadOnly="true" ></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
        <Scrolling AllowScroll="False" EnableVirtualScrollPaging="True" UseStaticHeaders="True"></Scrolling>
        <DataBinding Location="~/ems/EMSWS.asmx" StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maxRows"></DataBinding>
        <ClientEvents OnRowSelected="RowSelected" OnRowDeselected="RowDeselected" OnRowCreated="RowCreated" OnRowDataBound="RowDataBound" />
    </ClientSettings>
    <PagerStyle Mode="NumericPages" />   
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
<span onclick="deleteCustomers()" class="cms_hyperlink">Ontvangers verwijderen</span>

All grid logic is done here:
//Grid logic
var selected = {};
function RowSelected(sender, args) {
    var customerID = args.getDataKeyValue("CustomerID");
    if (!selected[customerID]) {
        selected[customerID] = customerID;
    }
}
function RowDataBound(sender, args) {
    //Every time a new page is loaded, all rows are unselected....
    var customerID = args.get_dataItem()["CustomerID"];
    if (selected[customerID]) {
        args.get_item().set_selected(true);
    }
    else {
        args.get_item().set_selected(false);
    }
}
function RowDeselected(sender, args) {
    var customerID = args.getDataKeyValue("CustomerID");
    if (selected[customerID]) {
        selected[customerID] = null;
    }
}
function RowCreated(sender, args) {
    var customerID = args.getDataKeyValue("CustomerID");
    if (selected[customerID]) {
        args.get_gridDataItem().set_selected(true);
    }
}
 
//Deleting customers
function deleteCustomers() {
    WSdeleteCustomers();
}
function WSdeleteCustomers() {
    var dfd = new jQuery.Deferred();
    $.ajax({
        type: 'POST',
        url: "/ems/emsws.asmx/RemoveEmailFromAudience",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        data: "{ 'strCustomerIDs': '" + GetSelectedCustomers() + "', 'iAudienceID': '" + getParameterByName('id') + "' }",
        cache: false,
        success: function (data) {
            dfd.resolve();
        }
    }).done(function () {
        dfd.promise();
    }).pipe(function () {
        reloadGridAfterDelete();
    });
}
function GetSelectedCustomers() {
    var allids = '';
    var grid = $find("<%=AudienceRecipientsGrid.ClientID %>");
    var MasterTable = grid.get_masterTableView();
    var selectedRows = MasterTable.get_selectedItems();
    for (var i in selected) {
        allids = allids + i + ',';
    }
    return allids;
}
 
function reloadGridAfterDelete() {
    //console.log("reload grid");
    var masterTable = window.$find("<%= AudienceRecipientsGrid.ClientID %>").get_masterTableView();
    //masterTable.rebind();
    console.log("deleteSelectedItems()");
    masterTable.deleteSelectedItems();
    }







Antonio Stoilkov
Telerik team
 answered on 30 Aug 2012
1 answer
175 views
Dear Sir/Madam


Problem 1 : Inside Password Field How to show Error Text
==========================================
I have TextBox which accept Password as Input 
I want to validate 
1)Must be Required Field
2)Minimum Password Characters is 6.If user enters password less than 6.
I want to show Error Message Inside Password Textbox(Min.6 Chracters like that)


How to do above using RadInputManager?


I  set  Empty Message and ErrorMessage for Password Textbox.But it is doesn't works


Becoz Having TextMode=Password show Required Text in the form of Bullets


I want to show Error Message inside TextBox with effects similar to RadNumeric Text




My ASPX
========
<form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
    <div>
    <span>Password&nbsp;:&nbsp;</span>
   
    <asp:TextBox ID="txtpwd" runat="server" TextMode="Password" Width="150px" Height="20px"></asp:TextBox>
     </div>
       <telerik:RadInputManager ID="RadInputManager1" runat="server">
     <telerik:TextBoxSetting BehaviorID="PasswordBehavior" EmptyMessage="Password" ErrorMessage="Required"  Validation-IsRequired="true" >
   
    <TargetControls><telerik:TargetInput ControlID="txtpwd" /></TargetControls>
 
     <PasswordStrengthSettings ShowIndicator="true"  RequiresUpperAndLowerCaseCharacters="False" PreferredPasswordLength="6" MinimumUpperCaseCharacters="0" MinimumSymbolCharacters="0" MinimumNumericCharacters="0" MinimumLowerCaseCharacters="0" />
    </telerik:TextBoxSetting>
    </telerik:RadInputManager>
   
    </form>


==========================================




With Regards,
Maha 
Kostadin
Telerik team
 answered on 30 Aug 2012
1 answer
143 views
Problem 1 : How to use validate custom JavaScript Function using RadInputManager
==========================================================
I have TextBox which accept Email Id as Input 
I want to validate following 


V1)Must be Required Field
V2)Must be valid Email Id
V3)Domain Part should not matched with gmail.com or yahoo.com etc
V4)I want to check that email id in DataBase(Already registerd id or not)


The above V1 and V2  i can achieve using 


Validation-IsRequired="true"  ValidationExpression="^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$" ErrorMessage="Invalid Email"


But instead of your code i want to validate using My JavaScript Code


Current Now i'm displaying Error Message in Label


But I want to show my Error Message inside TextBox


I don't know how to get BehaviorID of txtemailid(textbox) and How i set My Custom Error Message inside TextBox


I.e How can i access Validation-IsRequired and ErrorMessage Properties using script?


Also As I mentioned Earlier I want to check that email id in DataBase(Already registerd id or not)..How can i achieve this using RadInputManager


Please solve my problem..Thank You


My ASPX
========
<form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />


    <div>
      <div id="divemail">
            <div style="width:150px; float:left; font-weight:bold;"><span style="color:Red;">*</span>&nbsp;Email Id</div>
            <div>
            <div style=" width:235px; float:left;">
          <asp:TextBox ID="txtemailid" Width="150px" runat="server"></asp:TextBox>
              
              </div></div>
            <div style=" float:left; height:10px; padding-left:10px;"> 
                <asp:Label ID="lblemail" runat="server" ForeColor="#CC0000"></asp:Label> 
            
            </div>
        </div>
    </div>
    
    
    
    <telerik:RadInputManager ID="RadInputManager1" runat="server">
    
    
   <telerik:RegExpTextBoxSetting ClientEvents-OnBlur="EmailValidate" BehaviorID="Regexemailid" runat="server" EmptyMessage="Email Id">
   <TargetControls><telerik:TargetInput  ControlID="txtemailid"/></TargetControls>
   




   
    </telerik:RegExpTextBoxSetting>
   </telerik:RadInputManager>
   
   </form>
    <script type="text/javascript" language="javascript">


        function EmailValidate(sender, eventArgs) {
           
            document.getElementById('lblemail').innerHTML = "";
            var emailid = eventArgs.get_targetInput().get_value();
          
            if (emailid.length == 0)
            {
                document.getElementById('lblemail').innerHTML = "Required";


                args.IsValid = false;
            }
            //Invalid Email id
            else if (emailid.length > 0 && emailid.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1)
            {
                document.getElementById('lblemail').innerHTML = "Invalid Email ID";
                args.IsValid = false;
            }
            //This block has only Valid Email Ids--We have to check that domain
            else if (emailid.length > 0 && emailid.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
            {  
               var domain = emailid.toLowerCase();
                   domain = domain.substring(emailid.indexOf("@") + 1, emailid.length);
               if (domain == "yahoo.co.in" || domain == "gmail.com") {
                        document.getElementById('lblemail').innerHTML = "This Domain (" + domain + ") has been Blocked.Please choose different Email Id";                      
                 }
                args.IsValid = false;
            }
      


        }
        
    
    </script>




==========================================


With Regards,
Maha
Tsvetina
Telerik team
 answered on 30 Aug 2012
3 answers
171 views
Hi All,

I am using a RadComboBox with checkboxes and I want to get its checked item on button click. For this I am using CheckedItems property of combo box.

I am correctly getting the checked items if I use the combo box outside a RadGrid, but when I use the same combo box inside a RadGrid, I am not getting any checked items (count=0). I can correctly get the text of combo box, but cannot understand what is problem with getting the checked items.

Please help!!! Thanks in advance...

Dhaval
Ivana
Telerik team
 answered on 30 Aug 2012
1 answer
149 views
hi this is the structure of my page..
loading panel is working fine in Chrome and IE8.
but in FireFox page is not completely loaded but the loading image vanished.

<asp:Content ID="Content4" ContentPlaceHolderID="PageCenterContent" runat="server">
  
   <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
        function pageLoad(sender, eventArgs) {
        
              if (!eventArgs.get_isPartialLoad()) {
                var myAjaxControl = <%= RadAjaxManager1.ClientID %>;
                    myAjaxControl.ajaxRequest();
               }
          
        }
        
     

     function OnResponseEnd(sender, eventArgs)
        {      
           var currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID %>");
            var currentUpdatedControl = "ctl00_PageCenterContent_Radpanebottom";
            currentLoadingPanel.hide(currentUpdatedControl);
              
        }

        function OnRequestStart(sender, eventArgs)
        {
            var currentLoadingPanel = $find("<%= RadAjaxLoadingPanel1.ClientID %>");
            var currentUpdatedControl = "ctl00_PageCenterContent_Radpanebottom";
            currentLoadingPanel.show(currentUpdatedControl);
        
        }
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
         ClientEvents-OnRequestStart="OnRequestStart"
        ClientEvents-OnResponseEnd="OnResponseEnd" onajaxrequest="RadAjaxManager1_AjaxRequest1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Web20" IsSticky="false"
        Height="220px">
    </telerik:RadAjaxLoadingPanel>
    <%-- start RadSplitterContent--%>
    <telerik:RadSplitter ID="radSplitterContent" runat="server" Skin="WebBlue" LiveResize="True"
        Width="95%" CssClass="marginAuto" Height="720">
        <%-- start RadPaneSensorBar--%>
      
        <telerik:RadPane ID="RadPaneSensorBar" runat="server" Height="100%" Width="272" MaxWidth="265">
          <fieldset class="Sensorgrp">
           <legend style="text-align:left;">Sensor Group</legend>
            <telerik:RadPanelBar ID="sensorPanelBar" runat="server" ExpandMode="SingleExpandedItem"
                Skin="WebBlue" OnItemClick="sensorPanelBar_ItemClick" OnItemDataBound="sensorPanelBar_ItemDataBound">
            </telerik:RadPanelBar>
            </fieldset>
        </telerik:RadPane>
        <%-- End RadPaneSensorBar--%>
      
        <%-- start RadpaneMid--%>

        <telerik:RadPane ID="RadpaneMid" runat="server" Scrolling="None" Height="700" Width="720">
            <%-- start RadsplitterMid--%>
           

            <telerik:RadSplitter ID="RadsplitterMid" runat="server" Orientation="Horizontal" Width="680" >
                <%-- start RadPaneRotator--%>
                
                <telerik:RadPane ID="RadPaneRotator" runat="server" Scrolling="None" Height="75" Width="680">
                 <fieldset style=" height:59px; width: 697px;">
              <legend style="text-align:left;">Sensors</legend>
            
                    <telerik:RadRotator ID="SensorRadRotator" runat="server" ScrollDuration="2000" RotatorType="Buttons"
                        Height="50px" ItemHeight="20px" Width="590px" ItemWidth="200px" CssClass="marginAuto boarderNone"
                        Skin="MetroTouch" OnItemDataBound="SensorRadRotator_ItemDataBound"
                         OnItemClick="SensorRadRotator_ItemClick1">
                        <ItemTemplate>
                            <div class="product bgpurple" runat="server" id="Product">
                                <div class="productleft" runat="server" id="productleft">
                                <asp:Image ID="StatusImg" runat="server" ImageUrl="~/Images/play-icone-6427-16.png" />
                                 
                                </div>
                                <div class="productright">
                                    <asp:Label ID="lblName" runat="server" Style="color: white; float: left; font-weight: bold;"></asp:Label>
                                    <asp:HiddenField ID="hdnSensorId" runat="server" />
                                    <br />
                                    <asp:Label ID="lblStatus" runat="server" Style="color: white; float: left;"></asp:Label>
                                </div>
                            </div>
                        </ItemTemplate>
                    </telerik:RadRotator>
                       </fieldset>         
                </telerik:RadPane>
               
 
                <%-- end RadPaneRotator--%>
                <%-- start Radpanebottom--%>
                <telerik:RadPane ID="Radpanebottom" runat="server" Scrolling="none" Height="650">
                </telerik:RadPane>
                <%-- end Radpanebottom--%>
            </telerik:RadSplitter>                          
               
            <%-- End RadsplitterMid--%>
        </telerik:RadPane>
        <%-- End RadpaneMid--%>
    </telerik:RadSplitter>
    <%-- End  RadSplitterContent--%>

   
                    
</asp:Content>



Eyup
Telerik team
 answered on 30 Aug 2012
3 answers
115 views
Hi all,
How to persistence the selected row of file explorer during the sorting and paging of telelrik file explorer grid.
I detected  TELERIKs new version have  already build in functionality of persistence the selected row during the sorting and paging. i am using DOTNETNUKE 6.1.5 and telelrik version is -2012.1.411.35,
is there any version problem ? or how can i do this ...
Dobromir
Telerik team
 answered on 30 Aug 2012
1 answer
122 views
Hello,

How to get client id of all date picker control on a page using javascript like the way we can get array of rad comboboxes


teleric.web.ui.Radcombobox.comboboxes[i]...

so is there any way to get clientid/array of date picker control


thanks,
Nilesh 
Eyup
Telerik team
 answered on 30 Aug 2012
21 answers
558 views
I've set the style of the empty message to:
<EmptyMessageStyle Font-Italic="True" ForeColor="#999999" /> 
when hovering over the textbox, however, this style is lost and it reverts to it's default font.  Is there something else I need to set or is this a defect?

Respectfully,

Jeff Beem
Vasil
Telerik team
 answered on 30 Aug 2012
5 answers
99 views
After upgrading to Q2 2012 I quickly noticed 2 issues:

1.
myradinput.Focus();
No longer focuses the control.

2.
function(sender, args) { $get('" + BadgeNo.ClientID + "' + '_text').focus(); }
Throws a JS error saying something like object not found.

The 2nd Issue I fixed by removing the _text suffix however this is of course not something acceptable.

For the 1st issue I found no fix so I was forced to revert back to Q1.
Vasil
Telerik team
 answered on 30 Aug 2012
3 answers
88 views
Hi,

As we have related combobox functionality with RadCombobox. I want to use such functionality with RadGridDropDownColumn in RadGrid.

Is it possible to do?if you can provide any sample code for that.it will be very helpfull.

Thanks.
Rootvik Pancholi.
Tsvetina
Telerik team
 answered on 30 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?