Telerik Forums
UI for ASP.NET AJAX Forum
12 answers
276 views
I recently upgraded to the Q2 2012 controls and immediately started having an issue with my search button.  User can enter a name to search.  Pressing ENTER will begin the search.  I initiate the click event when the ENTER key (keyCode=13) is pressed.  In the previous release this worked perfectly.  Now I must put in a delay because there is no value returned from the get_value() on the first attempt.  Can this be explained??  I have included code and jpg images showing the alert get_value() in sequence.  I keyed in "bee" into the text box and pressed ENTER.  The jpgs show the results.

I am putting in a slight delay to correct for the moment.  I would really like an explanation because now I worry I'm going to find other issues.
Thanks
John

<telerik:RadTextBox ID="txtSearch" runat="server" EmptyMessage="Enter First or Last Name..."
 Width="145px" Skin="WebBlue">
 <PasswordStrengthSettings IndicatorWidth="100px" />
 <ClientEvents OnKeyPress="onKeyPressed" />
</telerik:RadTextBox>

function onKeyPressed(sender, args) {
 var search = $find("<%= btnSearch.ClientID %>");
 //ENTER key pressed on Search
 if (args.get_keyCode() == 13) {
  alert('Value=' + sender.get_value() + '  Time=' + Date());
  alert('Value=' + sender.get_value() + '  Time=' + Date());
  search.click();
  args.set_cancel(true);
 }
}


 

 

 

 

 

 

Vasil
Telerik team
 answered on 10 Aug 2012
1 answer
297 views
(The title of this thread is not quite accurate.  The title should be: "A RadComboBox event SelectedIndexChanged fires when the control is programmatically checked with exactly one checkbox item")

I have a RadComboBox that contains CheckBox items.  I programmatically set certain items as Checked, if data exists in a database table.  Here is a segment of code:

Dim idr As Data.DataRow
Dim ids As Data.DataSet
  
Dim idt As Data.DataTable
Dim idtData As New Data.DataSet
  
Dim iParameters(0 To 0) As Data.SqlClient.SqlParameter
iParameters(0) = New Data.SqlClient.SqlParameter("@intBIDOID", CheckDBNull(CInt(BIDOID), enumObjectType.IntType))
  
ids = clsEPD_DATA.StoredGetDataset("spGetBidsSystemTypeNames", iParameters)
  
If ids.Tables(0).Rows.Count >= 1 Then
    idt = ids.Tables(0)
  
    For Each idr In idt.Rows
  
        ' "BUG" - when one and ONLY one item is check-marked, here, it causes the control to
        ' be in a state as if SelectedIndex has been changed (Telerik states this is expected).
        ' And, it stays that way, even though we set it here, and the user did NOT change anything.
        ' This is a "bug" in our scenario, where I must determine if the USER DID THE CHANGE,
        ' not the program.
  
        Dim cboSTObject As RadComboBoxItem = cboSystemType.FindItemByValue(CheckDBNull(idr("SYSTOID"), enumObjectType.IntType))
        cboSTObject.Checked = True
        cboSTObject.Dispose()
  
    Next
  
    ids.Dispose()
  
End If
  
'------------ end of System Type checkboxed combobox ----------------------

Here is the aspx snippet:

<telerik:RadComboBox ID="cboSystemType" runat="server" Width="200px"
EmptyMessage="Select the System Type (if any):"
Height="250px" DataTextField="ST_Name" DataValueField="SYSTOID"
DataSourceID="SqlDataSource5" TabIndex="8" CheckBoxes="True"
CausesValidation="False"></telerik:RadComboBox>
<br/>
<asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:EPD_DATAConnectionString %>"
SelectCommand="spGetBidSystemTypeNames" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>

What I would like to do is create code such that when my programmatic method changes the index (which appears only to occur when only ONE items is check-marked, but never when zero, or two or more, items are check-marked by the program), that I can somehow set the SelectedIndex code to ignore it, but when the USER MAKES A CHANGE, then I pay attention to it.  Should I create an internal variable "flag" in my program to somehow watch for when I make changes programmatically, but clear the flag?  This seems clunky.

Any guidance would be appreciated.  Thank you.
Kalina
Telerik team
 answered on 10 Aug 2012
3 answers
117 views

I got what I thought was a really simple example to test the drilldown capability of the orgchart, but I'm getting an errror:
Sys.WebForms.PageRequestManagerServerErorrException :Object reference not set to an instance of an object.
I get this when I click on the little icon next to someone's name to drill down.
The page comes up fine and displays the chart, so I know there's nothing wrong with the query.
Here's the bare bones code:
Thanks ... Ed

<%@ Page Title="" Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeFile="TestOrgChart.aspx.cs" Inherits="SysAdmin_TestOrgChart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cntHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cntPageBody" Runat="Server">
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" >
        <telerik:RadOrgChart runat="server" ID="org1" EnableDrillDown="true">
 
        </telerik:RadOrgChart>
</telerik:RadAjaxPanel>
 
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using MyDB;
 
public partial class SysAdmin_TestOrgChart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadChart();
        }
    }
    private void LoadChart()
    {
        MyDataContext db = new MyDataContext();
            var qry = from a in db.STAFFs
                      select new { a.STAFF_SEQ,
                                          a.PARENT_STAFF_SEQ,
                                          FullName = a.LAST_NAME + ", " + a.FIRST_NAME };
 
 
            org1.DataSource = qry.ToDataTable();
            org1.DataFieldID = "STAFF_SEQ";
            org1.DataFieldParentID = "PARENT_STAFF_SEQ";
            org1.DataTextField = "FullName";
            org1.DataBind();
            org1.DisableDefaultImage = true;
    }
}
 
  
</asp:Content>


Ed Staffin
Top achievements
Rank 1
 answered on 10 Aug 2012
2 answers
96 views
Hello.
I have grid with custom aggregate in one column and export to PDF/Excel abilities. When I view in browser aggregation works ok, but there is no aggregation in exported documents. Here is my code:

<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True"
    OnItemCreated="RadGrid1ItemCreated" OnNeedDataSource="RadGrid1NeedDataSource"
    OnCustomAggregate="RadGrid1CustomAggregate" OnExcelMLExportRowCreated="RadGrid1ExcelMlExportRowCreated"
    OnExcelMLExportStylesCreated="RadGrid1ExcelMlExportStylesCreated" AllowFilteringByColumn="True"
    AllowSorting="True" CellSpacing="0" OnItemDataBound="RadGrid1ItemDataBound">
    <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
        <Excel Format="ExcelML" />
        <Pdf PageTitle="Charity Print-Out" Title="Charity Print-Out" PageHeight="210mm" PageWidth="500mm"
            DefaultFontFamily="Arial Unicode MS" PageBottomMargin="20mm" PageTopMargin="20mm"
            PageLeftMargin="20mm" PageRightMargin="20mm" />
    </ExportSettings>
    <PagerStyle Mode="NextPrevAndNumeric" />
    <MasterTableView AutoGenerateColumns="False" DataKeyNames="DonationId" CommandItemDisplay="Top"
        Width="100%" AllowPaging="True" NoDetailRecordsText="" NoMasterRecordsText=""
        ShowGroupFooter="true" UseAllDataFields="True">
        <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="False"
            ShowRefreshButton="False" ShowExportToPdfButton="True" />
        <PagerStyle Mode="NextPrevAndNumeric" />
        <Columns>
            <telerik:GridBoundColumn DataField="CHR_CHARITY_NAME" HeaderText="Charity Name" ReadOnly="True"
                UniqueName="CHR_CHARITY_NAME" Visible="False" />
            <telerik:GridBoundColumn DataField="DonationInternalId" HeaderText="Client Donation ID"
                ReadOnly="True" UniqueName="DonationInternalId" />
            <telerik:GridBoundColumn DataField="DonorName" HeaderText="Donor's Name" ReadOnly="True"
                UniqueName="DonorName" />
            <telerik:GridBoundColumn DataField="DonorAddress" HeaderText="Donor's Address" ReadOnly="True"
                UniqueName="DonorAddress" />
            <telerik:GridBoundColumn DataField="EmailAddress" HeaderText="Email" ReadOnly="True"
                UniqueName="EmailAddress" />
            <telerik:GridBoundColumn DataField="PermissionToContact" HeaderText="Permission To Contact"
                ReadOnly="True" UniqueName="PermissionToContact" />
            <telerik:GridBoundColumn DataField="DateOfDonation" HeaderText="Donation Date" ReadOnly="True"
                UniqueName="DateOfDonation" />
            <telerik:GridBoundColumn DataField="NotesToCharity" HeaderText="Donor Notes" ReadOnly="True"
                UniqueName="NotesToCharity" />
            <telerik:GridBoundColumn DataField="DonationAmount" HeaderText="Donation Amount"
                ReadOnly="True" UniqueName="DonationAmount" DataFormatString="{0:C}" Aggregate="Custom"
                FooterText=" " />
        </Columns>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="CHR_CHARITY_NAME" />
                </GroupByFields>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="CHR_CHARITY_NAME" HeaderText=" " HeaderValueSeparator=" " />
                    <telerik:GridGroupByField FieldName="CHR_BN_NUMBER" HeaderText="-" HeaderValueSeparator=" " />
                </SelectFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
    </MasterTableView>
</telerik:RadGrid>

And code-behind:

protected void RadGrid1CustomAggregate(object sender, GridCustomAggregateEventArgs e)
{
    if (e.Item.DataItem == null)
    {
        return;
    }
    const string result = "<table style=\"border-collapse:collapse;text-align:left;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" +
                          "<tr><td style=\"text-align:left;\">Total Donations:</td><td>${0}</td></tr>" +
                          "<tr><td style=\"text-align:left;\">Processing & Transaction Fees @ 8%:</td><td>${1}</td></tr>" +
                          "<tr><td style=\"text-align:left;\">Net Donation Amount:</td><td>${2}</td></tr>" +
                          "</table>";
    double totalDonations = 0, netDonationAmount = 0, fees = 0;
    foreach (DataRow row in dataTable.Rows)
    {
        if (row["CHR_CHARITY_NAME"].ToString() != ((DataRowView)e.Item.DataItem).Row.ItemArray[0].ToString())
        {
            continue;
        }
        if (row["DonationAmount"] != null)
        {
            totalDonations += (double)row["DonationAmount"];
        }
        if (row["NetDonationAmount"] != null)
        {
            netDonationAmount += (double)row["NetDonationAmount"];
        }
        if (row["Fees"] != null)
        {
            fees += (double)row["Fees"];
        }
    }
    e.Result = String.Format(result, totalDonations.ToString("0.00"), fees.ToString("0.00"), netDonationAmount.ToString("0.00"));
}

What I am doing wrong?
Daniel
Telerik team
 answered on 10 Aug 2012
1 answer
140 views

Is it possible to apply RadGrid Styles to asp.net Grid View? Any code sample?

I found this sample (BUT this one is for Generic HTML table)
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/using-telerik-skin-on-generic-table.aspx 
 It is applying webblue theme and it is NOT applying hover color..

I am looking for Hay or Forest theme. Where can I download those files?
Tsvetina
Telerik team
 answered on 10 Aug 2012
3 answers
197 views
This is kind of an odd problem. I have two environments. Both running SharePoint 2010. Same software and configuration on both. In dev my combobox works fine but once it's deployed to test the combobox acts like it is disabled. The combobox is in a radgrid and there is a javascript error when the row is expanded that the combobox is in. The error is "TypeError: h is not a constructor
https://site.com/ScriptResource.axd?d=W3VnxZIztGbCDKsquF9usLpO8arHyM1n_yidsMg0IaOQVKbSAKbUEBJDrGFGi4-QgmAjM7HywJgZHYjTu0Tn5eaeE4RtTKrP8BaZjX7dJkBEMXpkn7vpFGr21ix6C_gWer2-t6UM1llpQNJr7X0qxaAfP7A1&t=ffffffffb868b5f4
Line 5" Now this doesn't tell me much but I believe it is coming from the MicrosoftAjax.js that is included with the Telerik controls. We are currently on version 2012.1.301.35. Does anyone have any ideas on what could be causing this? 
Plamen
Telerik team
 answered on 10 Aug 2012
3 answers
128 views
Does anyone know if we can filter dropdownlist in the resourcetype?  I was able to create dropdownlists with values but can't filter them.  I'm not sure if Telerik scheduler have that feature.
I need to be able to filter the selections from a dropdownlist in the radscheduler in the resource type collection.  Please help.

<

 

 

telerik:RadScheduler ID="RadScheduler1" runat="server"

 

 

 

DataDescriptionField="Description" DataEndField="End_Date" DataKeyField="ID"

 

 

 

DataSourceID="SqlDataSource1" DataStartField="Start_Date"

 

 

 

DataSubjectField="Subject" EnableDescriptionField="True">

 

 

 

<ResourceTypes>

 

 

 

<telerik:ResourceType DataSourceID="SqlDataProgramtype"

 

 

 

ForeignKeyField="Programs" KeyField="Programs" Name="Programtype"

 

 

 

TextField="Programs" />

 

 

 

<telerik:ResourceType DataSourceID="SqlDatastaff" ForeignKeyField="Users"

 

 

 

KeyField="Full_Name" Name="Staff" TextField="Full_Name" />

 

 

 

<telerik:ResourceType DataSourceID="SqlDataRooms" ForeignKeyField="ROOMS"

 

 

 

KeyField="ROOMNAME" Name="Rooms" TextField="ROOMNAME" />

 

 

 

</ResourceTypes>

 

<

 

 

WebServiceSettings>

 

<

 

 

ODataSettings InitialContainerName=""></ODataSettings>

 

</

 

 

WebServiceSettings>

 

 

 

</telerik:RadScheduler>

 

Ivana
Telerik team
 answered on 10 Aug 2012
1 answer
70 views
Hi, I was testing the upload on your site and it worked fine in Motzilla, Chrome and Firefox but did not function properly in IE. I am using IE 8 on Windows 7 and the only thing I see is the Check Box, Gray Text box , and a remove button but no "Select button". However, when I click on the gray box I get the dialog with my files and if I select a file and click open nothing happens. In the other browsers the file name would appear in the box but not in IE. I tried in compatability mode as well but get the same results.

http://demos.telerik.com/aspnet-ajax/upload/examples/customizingraduploadui/defaultcs.aspx?RadUrid=c5d68f5f-7e5d-488b-a2d1-8b4fa981e412

Thanks,
Paul
Plamen
Telerik team
 answered on 10 Aug 2012
1 answer
387 views
Hi everyone,
I'm trying to do something I thought was quite simple. I have a RadGrid bound to a webservice (working fine!). For different reasons, I need a custom edit command for the grid. With Serverside-binding this is easily achieved using a simple GridButtonColumn and a custom CommandName. On the server I was used to get the edited row via 
Dim dataItem As GridDataItem = DirectCast(e.Item, GridDataItem)
dataItem.GetDataKeyValue("id")

However, due to the client-side binding to a webservice, that is no longer possible. So I thought I'd get it client-side instead and send it to the server separately (using RadAjaxManager for instance). However, the client-side OnCommand event does not seem to offer any way of getting a dataKeyValue, dataItem or even rowIndex of the gridRow that was clicked. I tried something like this:
function OnCommand(sender, args) {
     if (args.get_commandName() == "Edit1") {
          var CommandArg = args.getDataKeyValue("id");
     }
}

Obviously to no avail...

I guess my question boils down to:
Is there any practical way of getting a reference to the dataItem or even a rowIndex to the server on ItemCommand when the RadGrid is bound to a webservice?

Thanks in advance!
Tsvetoslav
Telerik team
 answered on 10 Aug 2012
2 answers
236 views
I've been reading the posts on how you get the radgrid to fill it's container to 100% som that when the user expands the browser window, the grid expands with it. The problem I'm getting is that when set to height=100%, the grid is outside the page. If I make it smaller so it's all visible, then the visible margin to the bottom of the window shrinks when I decrease the window height. Fine, it's percent, right? But you would think the radgrid would stay withing the window, which it doesn't.

When all parent containers and the grid is set to 100%, the grid displays larger than the window. It's contained in a pageview, in a tabstrip.
I believe that the height of 100% set on the grid is somehow not taking the fixed header into account or maybe my user control menu at the very top is offseting the container?

I would appreciate help. My desired look is of true Height = Auto, where the grid would keep a fixed distance from the bottom of the window.

Robert
Top achievements
Rank 1
 answered on 10 Aug 2012
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?