Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
94 views
Hello,

i am getting the following error when trying to filter a GridDateTimeColumn:

Neither of the types 'String' and 'Nullable`1' converts to the other

this is the markup i have:

<telerik:RadGrid ID="ProcessesRadGrid" runat="server" Width="97%"  OnItemCommand="ProcessesRadGridItemCommand"
AllowPaging="true" PageSize="10" OnPageIndexChanged="ProcessesRadGrid_PageIndexChanged" OnNeedDataSource="ProcessesRadGrid_NeedDataSource" OnSortCommand="ProcessesRadGrid_SortCommand" AllowSorting="True">
        <MasterTableView AutoGenerateColumns="false" DataKeyNames="AcProcesses.Acprocessid" ClientDataKeyNames="AcProcesses.Acprocessid"
            Width="100%" CommandItemDisplay="Top" AllowFilteringByColumn="true">
                <CommandItemSettings ShowAddNewRecordButton="false" />
                <Columns>
                    <telerik:GridBoundColumn HeaderText="Organization" DataField="AcProcesses.Organization.Organizationname"></telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn  HeaderText="Start Date" DataField="AcProcesses.StartDate" SortExpression="AcProcesses.StartDate" DataType="System.DateTime" PickerType="DatePicker" DataFormatString="{0:dd/MM/yyyy}"  FilterControlWidth="100px">
                    </telerik:GridDateTimeColumn>
                    ........

Not sure what I'm missing... the weird thing is that i have another grid on the same page with filtering working on dates... i also noticed that on that second grid the filter button has less options (ex: it doesn't have 'contains')

Princy
Top achievements
Rank 2
 answered on 24 Nov 2011
1 answer
75 views
Hi,

I want  an ID of parent Table and the datakey value of recently expanded column on child grid's need data source event.  My code returns null value for currentGrid.NamingContainer .

  void childRadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            try
            {
                RadGrid currentGrid = sender as RadGrid;
                
        GridDataItem  parentItem =  (currentGrid.NamingContainer as  GridNestedViewItem ).ParentItem as GridDataItem;
..
..
..
}

Any idea?
Thanks
Prava
Shinu
Top achievements
Rank 2
 answered on 24 Nov 2011
4 answers
84 views
I need to center align the date number in monthview. Also need to change the default font of the number. How can this be done? I have a picky customer.

Thanks,
Dan
Dan
Top achievements
Rank 1
 answered on 23 Nov 2011
3 answers
72 views
I am new to telerik.  I have just converted an web application to a telerik enabled web app.
I have a basic page (1 button, 1 label) and on button click label text changes.

Prior to converting this worked fine
Once coverted and if I run in debug it works fine (label updated)
Once published to localhost it not longer works (label not updated).  I can view the site properly just no label update on button click.

Just wondering if you could point me in the right direction here.

Thanks
Michael
Top achievements
Rank 1
 answered on 23 Nov 2011
4 answers
133 views
Hello,

I've been trying to implement a treeview with checkboxes for a SharePoint 2010 custom web part. Just by using the built-in node template, this works without a hitch.

However, a core requirement of this web part is that it is to be fully compliant with the WCAG 2.0 AA standard. Out of the box, the only issue that appears is that the checkboxes do not have a label associated with them; a requirement for WCAG 2.0 A compliance. i've read all over the site that the treeview is WCAG A compliant, but whether that's version 1.0 or 2.0 of the WCAG standard varies based on the source.

I stumbled across a forum post from 2009 which mentions using a custom NodeTemplate to fix the compliancy issue (link is here). The issue is indeed resolved. However, the fix then breaks any client-side checkbox functionality (CheckChildNodes, OnClientNodeCheck, etc). The current solution that I'm using is server-side code; this also has the unfortunate side-effect of causing a postback upon ANY node being selected.

Has anyone been able to find a solution to this problem by using any form of client-side navigation that does not require a postback to function properly?

Thanks
Ryan
Top achievements
Rank 1
 answered on 23 Nov 2011
3 answers
706 views
I'm sure the problem I'm having is something I am doing, but I have no idea what it might be.  Here's the situation...

I have a web page (.aspx/.aspx.cs) that is essentially a "master/detail" display.  The "master" record fields are displayed as labels and the "detail" records are displayed in a grid using a SQLDataSource with a Select Command that is set at run time depending upon the key value of the "master" record.

I have followed one of your grid examples in trying to set this page up, however I did not find one of your examples that uses filters/sorting on the grid and also contains the "master" data fields displayed above.

Here's what happens:
(a) When the page is first displayed everything is fine.  The "master" fields are populated corretly and the grid is populated correctly (although I have some minor display issues currently).  A screen capture of the resulting page is attached as "Picture 1".

(b) When I enter a filter (doesn't matter which column or what type of filter), the page is re-displayed and the grid is totally gone from the page. A screen capture of the resulting page is attached as "Picture 2".

(c) I have taken all of the grid-related code out of the .aspx and put in another page without the "master" data, applied a filter, and it works just fine.  A screen capture of the resulting page is attached as "Picture 3".  

Obviously the problem has something to do with the display of the "master" data.  But I just have no idea what it might be.  The code for the .aspx file only for the "Grid Only" page (used to produce "Picture 3") is attached next.  There is no code in the code behind page.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Z_GridTest.aspx.cs" Inherits="Z_GridTest" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 
      <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <!-- content start -->
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="SignersGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="SignersGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
 
    <div>
     
                        <telerik:RadGrid AutoGenerateColumns="false" ID="SignersGrid" runat="server" Width="99.7%"
                            AllowSorting="true" AllowFilteringByColumn="true" EnableLinqExpressions="false"
                            AllowPaging="false" PageSize="15"
                            BorderWidth="1px" BorderColor="#999999" EnableEmbeddedSkins="true" Skin="Default"
                            DataSourceID="SQLDataSource1"
                            ShowFooter="True" GridLines="None" >
                            <PagerStyle Mode="NextPrevAndNumeric" />
                            <GroupingSettings CaseSensitive="false" />
                            <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True"
                                ShowFooter="True" TableLayout="Auto">
                                <Columns>
 
                                    <telerik:GridBoundColumn FilterControlWidth="50px" HeaderText="FirstName" UniqueName="FirstName"
                                        DataField="FirstName" SortExpression="FirstName" >
                                    </telerik:GridBoundColumn>
 
                                    <telerik:GridBoundColumn UniqueName="LastName" Visible="true" DataField="LastName" SortExpression="LastName" >
                                    </telerik:GridBoundColumn>
 
                                    <telerik:GridBoundColumn UniqueName="VoterAddress" HeaderText="Address" DataField="Address" SortExpression="Address"  >
                                    </telerik:GridBoundColumn >
 
                                    <telerik:GridBoundColumn UniqueName="RemoveSignature" HeaderText="Remove" DataField="CountyId" >
                                    </telerik:GridBoundColumn>
                                     
                                    <telerik:GridBoundColumn UniqueName="MiddleName" Visible="false" DataField="MiddleName" >
                                    </telerik:GridBoundColumn>
 
                                    <telerik:GridBoundColumn UniqueName="NameSuffix" Visible="false" DataField="NameSuffix" >
                                    </telerik:GridBoundColumn>
 
                                </Columns>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                            </ClientSettings>
                        </telerik:RadGrid>
 
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:ElectronicPetitionSystemConnectionString %>"
    SelectCommand="SELECT VoterSignatureId, PetitionId, LastName, FirstName, MiddleName, NameSuffix, [Address], CountyId, Email, SignatureImage, CountyVoterId, MvdSerialNumber, DateSigned, ClientIpAddress, VoterSignatureStatusId, CreatedDate, ModifiedDate FROM VoterSignatures WHERE PetitionId = 1001"
    ProviderName="System.Data.SqlClient" runat="server">
    </asp:SqlDataSource>
 
    </div>
    </form>
</body>
</html>

The code below is the "full version" including the display of the "master" fields.  This page does contain one statement in the Page_Init  event (not a postback only) which sets the value of the Select Command based on the value of a request qeury string member.

<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/EPSDev3.master" AutoEventWireup="true" CodeFile="PetitionInfo.aspx.cs" Inherits="PetitionInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
    .VerticalAlign1 
    
        padding-top: 6px;
    }
</style>
 </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
      <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <!-- content start -->
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="SignersGrid">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="SignersGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
 
 
 
    <div style="width: 800px;">
        <div style="float: left; background-color: White; width: 100%; padding: 0px;">
            <table cellpadding="1" cellspacing="0" border="0" width="100%">
                <tr>
                    <td colspan="5" align="center" >
                        <h2>
                            <asp:Label ID="VoterAuthenticationLabel" runat="server" Text="<%$ Resources:Resource, PetitionInformationLabel %>"></asp:Label>
                        </h2>
                    </td>
                </tr>
                <tr>
                    <td width="2%">
                          
                    </td>
                    <td width="47%" valign="top">
                        <table width="100%">
                            <tr>
                                <td colspan="2" align="left" style="font-weight: normal; height: 12px;">
                                    <asp:Label ID="Label6" runat="server" Font-Bold="true" Text="<%$ Resources:Resource, CandidateInformationLabel%>"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="CycleLabel" runat="server" Text="<%$ Resources:Resource, CycleLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="ElectionCycleList" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label1" runat="server" Text="<%$ Resources:Resource, RaceLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="PoliticalRaceList" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label2" runat="server" Text="<%$ Resources:Resource, NameLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="CandidateName" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label3" runat="server" Text="<%$ Resources:Resource, AddressLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="CandidateAddress" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label4" runat="server" Text="<%$ Resources:Resource, CityStZipLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="CandidateCity" runat="server" Text=""></asp:Label>
                                       
                                    <asp:Label ID="CandidateState" runat="server" Text=""></asp:Label>
                                       
                                    <asp:Label ID="CandidateZipCode" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label5" runat="server" Text="<%$ Resources:Resource, CountyLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="CandidateCountyList" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="2%">
                          
                    </td>
                    <td width="47%"  valign="top">
                        <table width="100%">
                            <tr>
                                <td colspan="2" align="left" style="font-weight: normal; height: 12px;">
                                    <asp:Label ID="Label7" runat="server" Font-Bold="true" Text="<%$ Resources:Resource, ContactInformationLabel%>"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label8" runat="server" Text="<%$ Resources:Resource, NameLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="ContactName" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label9" runat="server" Text="<%$ Resources:Resource, PhoneLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="ContactPhone" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label10" runat="server" Text="<%$ Resources:Resource, EmailLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="ContactEmailAddress" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label11" runat="server" Text="<%$ Resources:Resource, WebSiteLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="ContactWebSiteURL" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label16" runat="server" Text="<%$ Resources:Resource, LinkToLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:Label ID="LinkToURL" runat="server" Text=""></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="2%">
                          
                    </td>
                </tr>
                <tr>
                    <td colspan="5">
                          
                    </td>
                </tr>
                <tr >
                    <td>
                          
                    </td>
                        <td align="center" valign="middle" colspan="3" >
                            <asp:Label CssClass="VerticalAlign1" ID="PetitionsListTitle" Font-Size="16px" Width="100%" BackColor="#565A43" Height="24px" ForeColor="#ffffff" Font-Bold="true" runat="server" Text="<%$ Resources:Resource, PetitionSignersLabel %>"></asp:Label>
                        </td>
                    <td>
                          
                    </td>
                </tr>
                <tr>
                    <td width="2%">
                          
                    </td>
                    <td colspan="3" valign="middle">
                        <telerik:RadGrid AutoGenerateColumns="false" ID="SignersGrid" runat="server" Width="99.7%"
                            AllowSorting="true" AllowFilteringByColumn="true" EnableLinqExpressions="false"
                            AllowPaging="false" PageSize="15"
                            BorderWidth="1px" BorderColor="#999999" EnableEmbeddedSkins="true" Skin="Default"
                            DataSourceID="SQLDataSource1"
                            ShowFooter="True" GridLines="None" >
                            <PagerStyle Mode="NextPrevAndNumeric" />
                            <GroupingSettings CaseSensitive="false" />
                            <MasterTableView AutoGenerateColumns="false" EditMode="InPlace" AllowFilteringByColumn="True"
                                ShowFooter="True" TableLayout="Auto">
                                <Columns>
 
                                    <telerik:GridBoundColumn FilterControlWidth="50px" HeaderText="FirstName" UniqueName="FirstName"
                                        DataField="FirstName" SortExpression="FirstName" >
                                    </telerik:GridBoundColumn>
 
                                    <telerik:GridBoundColumn UniqueName="LastName" Visible="true" DataField="LastName" SortExpression="LastName" >
                                    </telerik:GridBoundColumn>
 
                                    <telerik:GridBoundColumn UniqueName="VoterAddress" HeaderText="Address" DataField="Address" SortExpression="Address"  >
                                    </telerik:GridBoundColumn >
 
                                    <telerik:GridBoundColumn UniqueName="RemoveSignature" HeaderText="Remove" DataField="CountyId" >
                                    </telerik:GridBoundColumn>
                                     
                                    <telerik:GridBoundColumn UniqueName="MiddleName" Visible="false" DataField="MiddleName" >
                                    </telerik:GridBoundColumn>
 
                                    <telerik:GridBoundColumn UniqueName="NameSuffix" Visible="false" DataField="NameSuffix" >
                                    </telerik:GridBoundColumn>
 
                                </Columns>
                            </MasterTableView>
                            <ClientSettings>
                                <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                            </ClientSettings>
                        </telerik:RadGrid>
                    </td>
                    <td width="2%">
                          
                    </td>
                </tr>
 
                <tr>
                    <td colspan="5" align="center" >
                        <asp:Label ID="Label17" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
 
                <tr>
                    <td colspan="5" align="center" >
                        <asp:Label ID="SignatureCountMessage" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
 
                <tr>
                    <td colspan="5" align="center" >
                        <asp:Label ID="Label18" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
 
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
 
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
 
 
 
                <tr >
                    <td>
                          
                    </td>
                        <td align="center" valign="middle" colspan="3" >
                            <asp:Label CssClass="VerticalAlign1" ID="Label12" Font-Size="16px" Width="100%" BackColor="#565A43" Height="24px" ForeColor="#ffffff" Font-Bold="true" runat="server" Text="<%$ Resources:Resource, SearchPetitionSignersLabel %>"></asp:Label>
                        </td>
                    <td>
                          
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
                <tr>
                    <td width="2%">
                          
                    </td>
                    <td width="47%" valign="top">
                        <table width="100%">
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label15" runat="server" Text="<%$ Resources:Resource, FirstLastNameLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:TextBox ID="SearchFirstName" Width="80px" runat="server" TabIndex="1"></asp:TextBox>
                                       
                                    <asp:TextBox ID="SearchLastName" Width="80px" runat="server" TabIndex="2"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="2%">
                          
                    </td>
                    <td width="47%"  valign="top">
                        <table width="100%">
                            <tr>
                                <td align="left">
                                    <asp:Label ID="Label13" runat="server" Text="<%$ Resources:Resource, AddressLabel %>"></asp:Label>
                                </td>
                                <td align="left">
                                    <asp:TextBox ID="SearchAddress" runat="server" TabIndex="3"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td width="2%">
                          
                    </td>
                </tr>
 
                <tr>
                    <td colspan="5" align="center" >
                        <asp:RadioButtonList ID="TypeOfCompare" runat="server" CellSpacing="10" RepeatDirection="Horizontal" >
                            <asp:ListItem Enabled="True" Selected="True" Text="Contains the value anywhere" Value="1" />
                            <asp:ListItem Enabled="True" Selected="False" Text="Only check the beginning of the entry" Value="2" />
                        </asp:RadioButtonList>
                         
                        <br />
                        <asp:Label ID="SearchInstructions" runat="server" Text="<%$ Resources:Resource, SearchInstructionsLabel %>"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
                <tr >
                    <td>
                          
                    </td>
                        <td align="center" valign="middle" colspan="3" >
                            <asp:Label CssClass="VerticalAlign1" ID="Label14" Font-Size="16px" Width="100%" BackColor="#565A43" Height="24px" ForeColor="#ffffff" Font-Bold="true" runat="server" Text="<%$ Resources:Resource, CloseAndPrintLabel %>"></asp:Label>
                        </td>
                    <td>
                          
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                        <asp:Button ID="ClosePetitionButton" TabIndex="6" runat="server" Text="<%$ Resources:Resource, ClosePetitionBtn %>" />
                            
                        <asp:Button ID="PrintListButton" TabIndex="7" runat="server" Text="<%$ Resources:Resource, PrintListBtn %>" />
                            
                        <asp:Button ID="PrintForFilingButton" TabIndex="8" runat="server" Text="<%$ Resources:Resource, PrintForFilingBtn %>" />
                    </td>
                </tr>
                <tr>
                    <td colspan="5" align="center" >
                          
                    </td>
                </tr>
            </table>
        </div>
        <div class="clear">
        </div>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:ElectronicPetitionSystemConnectionString %>"
        ProviderName="System.Data.SqlClient" runat="server">
    </asp:SqlDataSource>
 
 
</asp:Content>

Can anyone tell me why the display of the "master" data messes with the display/re-display of the grid on the page?

Many thanks in advance for your efforts!

Lynn






Lynn
Top achievements
Rank 2
 answered on 23 Nov 2011
1 answer
126 views
We have a complex use case with a RadGrid inside a panel on a page with a master page, multiple user controls, vaildators, a defaultbutton &c.
The problem is that with all this going on, accessing the RadGrid via tab and enter keys has become problematic.

Tabbing through the page and getting to the [+] Add New Record buttons (the InitInsert buttons?) on the page, and then hitting enter in the default scenario causes our default button for the page to fire which is not what we want.  We'd like the same thing to happen as if we clicked on it - a new row to be added to the grid.

As a work around, I have enabled keyboard validation, and set the OnKeyPress event in the client events to call javascript where I evaluate the key, see if it's the enter key, and then if so, examine the innerHTML to see what sent it to the JS.

This is bad enough and a poor solution for obvious reasons.  However, for the cancel button that is part of the GridEditCommandColumn, the validators on the page are firing which is not what happens when you just click on the Cancel link button in the grid.

I figure there has to be a better built in way of accessing the grid fully via the keyboard with standard tab and enter keys, rather than the non standard keyboard shortcuts, or if I have to do it htis way for all the buttons in the control to be properly caught and handled through javascript.

Any advice would be appreciated.
function OnKeyPress(key)
{
 var e = window.event;     
 if(e.keyCode==13) {
      
     if (e.srcElement.outerHTML.indexOf("AddNewRecordButton") > -1 || e.srcElement.outerHTML.indexOf("$InitInsertButton") > -1) {
         __doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl02$ctl00$InitInsertButton', '');
         return false;
     }
     if (e.srcElement.outerHTML.indexOf("ctl02_CancelButton") > -1) {
         __doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl02$ctl02$CancelButton', '');
         return false;
     }
     if (e.srcElement.outerHTML.indexOf("ctl04_CancelButton") > -1) {
         //__doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$CancelButton', '');
         WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$CancelButton", "", true, "StateAllocationValidation", "", false, true));
         return false;
     }
 
     if (e.srcElement.outerHTML.indexOf("$PerformInsertButton") > -1) {
         WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl02$ctl02$PerformInsertButton", "", true, "", "", false, true));
         return false;
     }
     if (e.srcElement.outerHTML.indexOf("$EditButton") > -1) {
         __doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$EditButton', '');
         return false;
     }
     if (e.srcElement.outerHTML.indexOf("Delete") > -1) {
         __doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$ctl00', '');
         return false;
     }
     if (e.srcElement.outerHTML.indexOf("UpdateButton") > -1) {
         WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl04$UpdateButton", "", true, "StateAllocationValidation", "", false, true));
         return false;
     }
 }      
}

Tsvetoslav
Telerik team
 answered on 23 Nov 2011
8 answers
150 views
I have a web site that uses the telerik:RadMaskedTextBox for the input of telephone numbers and social security numbers.  I recently upgraded my machine to IE9 and started observing some odd behavior.  FYI I can reproduce the issue on your Demo site as well.  Here's what I observed.  With the IE broswer not in Compatibility View mode, go to the Input: RadMaskedTextBox: First Look section of your Demo site.  Change the "Select Mask" to SSN.  Set focus to the Input Box.  Start typing a number.  The number will show up then when you type the next number the box will reset and start typing in the 2nd character location totally losing the 1st number that was typed.  Change the browser to Compatibility View and the InputBox works as expected.

I hope I explained this properly so you can reproduce and fix.  If not, let me know and I will try and do some kind of a screen capture video thing to try showcase this issue.

Thanks
Steve
Martin
Telerik team
 answered on 23 Nov 2011
1 answer
627 views
I need to inject one more attribute text-align:right into a particular gridboundcolumn. It is already getting page inherited styles. .Itemstyle.Horizontalalign does not have any effect but when I inject text-align:right into the same it works (Verified as in Firebug).

Can you guide me how to inject this attribute to already existing style tag of gridboundcolumn?
Jayesh Goyani
Top achievements
Rank 2
 answered on 23 Nov 2011
2 answers
112 views
Hi,

I'm having a problem ... and it may be related to the ID of the combo was renamed dynamically due to a partial post back.
I have a Page which has a Combo Box A showing my provinces, In this page I call a dynamic user control which is refreshed everytime Combo Box A is changed.

In my UC, I have another Combo Box B ( the problematic Combo) and on this UC ( Page_Init) I inject a JS in which i have the following snippet

string jsFunction =
@"
//Search TAB
//cmbSearchType - shows relevant input fields
function DefineView(sender, eventArgs) {
var comboSearch = $find('%%cmbSearchType%%');
//cmbSearch Section
switch (comboSearch.get_selectedItem().get_value()) {
[[MY CODE HERE]
}
}

function onPageLoad(){
$(document).ready(function(){
DefineView();
});
}";

ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "SearchVisibilityPPSA",jsFunction.Replace("%%cmbSearchType%%", cmbSearchType.ClientID),true); 

string onLoadScript = @"Sys.Application.add_load(function(){ onPageLoad();})
";


ScriptManager.RegisterStartupScript(this, this.GetType(), "onLoadScript", onLoadScript, true);

As you can see, I replace the ClientID, and on first load of the page, this is resolved correctly like ctl00_PrincipalPlaceHolder_ctl00_cmbSearchType but when I change Combo A, it reload the user control, which in turn reload the script above. In the rendered HTML, The COmbo ID is renamed to ctl00_PrincipalPlaceHolder_ctl01_cmbSearchType (Note the subtle change in name from ct00 to ct01 ) In my debug, I saw this ClientID contain the new ID but somehow it is not replaced regenrated on the rendered html.

I guess my question is how do i force the JS to be re-rendered every time this UC is called? For some reason, it is always using the original rendered JS ( which is why it is working the first time)

Thanks
Gotcha
Top achievements
Rank 1
 answered on 23 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?