Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
492 views
I'm using a RadButton inside a RadListView with ItemTemplate.  The button is supposed to cause a post-back (handled by the ItemCommand of the RadListView) if a value in a RadTextBox is present, otherwise just display the RequiredFieldValidator/ValidationSummary info.

I've got it working to the point where it will validate the field (it pops the RequiredFieldValidator message as per the instructions in the ValidationSummary control), however regardless of whether or not the validator fires, it still does the postback and fires the ItemCommand handler.

html:
<telerik:RadListView ID="lstCommissions" runat="server"
    DataKeyNames="EmployeeCommissionBankID"
    ItemPlaceholderID="plhCommissions"
    OnItemCommand="lstCommissions_ItemCommand"
    OnItemDataBound="lstCommissions_ItemDataBound"
    OnNeedDataSource="lstCommissions_NeedDataSource"
>
    <LayoutTemplate>
  
<div class="CommissionControlContainer">
    <div class="LoanNumberTitle">Loan Number</div>
    <div class="CommissionTotalTitle">Commission</div>
    <div class="SpreadTitle">Commission Spread</div>
    <asp:PlaceHolder ID="plhCommissions" runat="server" />
</div>
  
    </LayoutTemplate>
  
    <ItemTemplate>
  
    <div class="RowContainer">
        <div class="LoanNumber"><asp:Label ID="lblLoanNumber" runat="server" /></div>
        <div class="CommissionTotal"><asp:Label ID="lblCommissionTotal" runat="server" /></div>
        <div class="SpreadButton">
            <telerik:RadButton ID="btnSplit" runat="server"
                AutoPostBack="true"
                ButtonType="ToggleButton"
                CausesValidation="true"
                CommandName="Split"
                CommandArgument='<% Bind("LoanNumber"); %>'
                Style="padding-left: 25px;"
                ToggleType="CheckBox"
            >
                <ToggleStates>
                    <telerik:RadButtonToggleState PrimaryIconCssClass="rbRemove" Text="Remove Spread" />
                    <telerik:RadButtonToggleState PrimaryIconCssClass="rbOk" Text="Spread" />
                </ToggleStates>
            </telerik:RadButton>
        </div>
        <div class="SpreadValue">
            <telerik:RadNumericTextBox ID="txtSpreadAmount" runat="server"
                AutoPostBack="true"
            />
            <asp:RequiredFieldValidator ID="rfvSpreadAmount" runat="server" 
                ControlToValidate="txtSpreadAmount"
                ErrorMessage="Spread amount is required"
                Text="*"
            />
            <asp:ValidationSummary ID="vsSpreadAmount" runat="server"
                DisplayMode="BulletList" 
                ShowMessageBox="true" 
                ShowSummary="false"
                Visible="true"
            />
        </div>
          
    </div>
  
    </ItemTemplate>
  
</telerik:RadListView>

Just to verify to you that I'm setting the ValidationGroup for all controls involved (it is being set in code in the ItemDataBound handler):

if (e.Item is RadListViewDataItem)
{
    RadListViewDataItem item = e.Item as RadListViewDataItem;
  
    // item-level objects
    Label lblLoanNumber = item.FindControl("lblLoanNumber") as Label;
    Label lblCommissionTotal = item.FindControl("lblCommissionTotal") as Label;
    RadNumericTextBox txtSpreadAmount = item.FindControl("txtSpreadAmount") as RadNumericTextBox;
    RadButton btnSplit = item.FindControl("btnSplit") as RadButton;
    RequiredFieldValidator rfvSpreadAmount = item.FindControl("rfvSpreadAmount") as RequiredFieldValidator;
    ValidationSummary vsSpreadAmount = item.FindControl("vsSpreadAmount") as ValidationSummary;
  
    EmployeeCommissionEntity ec = item.DataItem as EmployeeCommissionEntity;
  
    if (ec.Amount.HasValue)
    {
        // set the validation groups for all the controls that need it
        btnSplit.ValidationGroup =
        txtSpreadAmount.ValidationGroup =
        rfvSpreadAmount.ValidationGroup =
        vsSpreadAmount.ValidationGroup =
            "Split_" + ec.EmployeeCommissionBankID.ToString().Replace("-", string.Empty);
  
        lblLoanNumber.Text = ec.LoanNumber;
        lblCommissionTotal.Text = string.Format("{0:c}", ec.Amount);
  
        txtSpreadAmount.MaxValue = ec.Amount.Value.ToDouble();
        txtSpreadAmount.MinValue = 0;
    }
    else
        item.Visible = false;
}

Any ideas?  I'm going to handle this server-side (I'll test the text box and if it's blank I'll set the toggle of the button back to unchecked) but I'd really like the standard asp controls to handle it so no post-back happens unless it needs to.

Thanks
-
Scott
Pero
Telerik team
 answered on 17 Feb 2011
3 answers
413 views
I have a master page and a derived web content form using the specified master page.  Any javascript I place in my Content1 and the body of the page goes in Content2.  The issue is that I am calling a javacript but since the controls only exist in the Edit Mode of the RadGrid, when the page loads it is firing an error stating that the controls do not exist in the context.

Javascript
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
        <script type="text/javascript">
  
           function copyAmount() {
               if (document.getElementById("<%=tbApprovedAmount.ClientID%>")) {
                   document.getElementById("<%=tbApprovedAmount.ClientID%>").value = document.getElementById("<%=tbRequestedAmount.ClientID%>").value;
               }
  
           
        </script
</asp:Content>

Aspx
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
.
.
<EditFormSettings EditFormType="Template" FormStyle-BackColor="#DBE9FD">
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
<FormStyle BackColor="#DBE9FD" />
<FormTemplate>
<table width="800px" border="0" >
<tr
<td align="left"
<asp:TextBox ID="tbRequestedAmount" runat="server" 
Text='<%# Bind("RequestedAmount", "{0:0.00}") %>' ></asp:TextBox
<asp:RequiredFieldValidator ID="rfvRequestedAmount" runat="server" ErrorMessage="Requested amount is a required field" 
Display="None" ControlToValidate="tbRequestedAmount" ValidationGroup="Service"></asp:RequiredFieldValidator
<asp:Button ID="tbCopy" runat="server" Text="->" Height="20px"  
OnClientClick="copyAmount" /> 
</td
</tr
</table>                                                                    
</FormTemplate>
</EditFormSettings>
.
.
.
</asp:Content>
Veli
Telerik team
 answered on 17 Feb 2011
5 answers
113 views
Hi,

             I am using RadAsyncUpload control in my application,  I am unable to see the Upload button in IE, it is visible in firefox...
I have tried by disable the flash, but also it is not working...
How can I solve this Problem?
Rahul Barpha
Top achievements
Rank 1
 answered on 17 Feb 2011
2 answers
321 views
Hi Telerik Team,

I am working on the Telerik Grid, my first column in that grid is "GridClientSelectColumn", with which I am able to 'check' the required row and save to the database, but I could not bind the saved items to that "GridClientSelectColumn". Below is the sample code which I am using.

1. In Aspx Page

 

 

 

 

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true"

 

 

 

 

 

AllowAutomaticUpdates="True" PageSize="10" Width="100%" AutoGenerateColumns="false"

 

 

 

 

 

AllowMultiRowSelection="true" DataSourceID="sds_Reconcile" onitemcreated="RadGrid1_ItemCreated"

 

 

 

 

 

OnItemDataBound="RadGrid1_ItemDataBound" OnPreRender="RadGrid1_PreRender">

 

 

 

 

 

 

<PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" />

 

 

 

 

 

<MasterTableView Name="Table1" DataKeyNames="id" AllowMultiColumnSorting="True" AllowFilteringByColumn="true" TableLayout="Fixed" EditMode="InPlace" CanRetrieveAllData="False">

 

 

 

 

 

 

<HeaderStyle CssClass="Level1HeaderStyle" />

 

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:GridClientSelectColumn DataTextField="pvkey" Text="select" UniqueName="column1"

 

 

 

 

 

HeaderText="Select"> </telerik:GridClientSelectColumn>
...
</Columns>
2. C# Code
    a.  In ItemDataBound and ItemCreated i have used this code

 

 

 

 

        if (e.Item is GridDataItem)            {

 

 

 

 

 

            GridDataItem item = (GridDataItem)e.Item;

 

 

 

 

 

            if (item.OwnerTableView.Name == "Table")    {

 

 

 

 

 

                if (item["is_recon"].Text == "True") {

 

 

 

 

 

                    CheckBox chkbx = (CheckBox)item["column1"].Controls[0];

 

 

                            chkbx.Checked =

 

 

true;

 

 

                    e.Item.BackColor = System.Drawing.

 

 

ColorTranslator.FromHtml("green"); }}}

 

 

    b. In PreRender, I am using this code
        

 

 

            foreach

 

 

 

(GridDataItem dataItem in this.RadGrid1.MasterTableView.Items)

 

 

                    {

 

 

 

 

                        if (dataItem["is_recon"].Text == "True")

 

 

                    {

 

 

 

 

                        CheckBox chkbx = (CheckBox)dataItem["column1"].Controls[0];

 

 

                        chkbx.Checked =

 

 

true;

 

 

                        }

 

 

 

 

                    dataItem["column1"].BackColor = System.Drawing.Color.Gray;

 

 

 

 

 

 

 

 

 

                       }

 I am able to get the correct values from the database, and they are executing with the chkbx.Checked = true. But I could not see the items checked in the webpage when they are loaded.

And also I am using Default skin, and assigning my custom css to that Grid, with which I am unable to color the row. (dataItem["column1"].BackColor = System.Drawing.Color.Gray;)

Thanks
Mark

 

 

 

 

 

 

 

 

 

 

 

 

 

Mark
Top achievements
Rank 1
 answered on 17 Feb 2011
3 answers
531 views
Dear developers hello,

I use RadExplorer, in my classic website, with the option to download (or open) files with double click. It works great.

Now i changed my pages and i use Master and Content pages, instead of classic.
RadExplorer is in the Content Page of a Master Page.
After that change, the download is not working. I double click the file and it does nothing (download or open).
The file Handler.ashx is the same.

I use:
Visual Studio 2008 v9.0.30729.1 SP (ASP.NET Visual Basic)

RadControls for ASP.NET Ajax 2010.2.929.35 Trial

Windows 7

If you need any other information, please let me know.
Thank you in advance for your time.

Best Regards
Navarino Technology Department

Below you will find the code of my content page.

<%@ Page Title="" Language="VB" MasterPageFile="~/mpMainMenu.master" AutoEventWireup="true" CodeFile="cInvoices.aspx.vb" Inherits="cInvoices" %>
 
 
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p>
        <span class="style1">
        <telerik:RadScriptManager
            ID="RadScriptManager1"
            runat="server">
        </telerik:RadScriptManager>
        Welcome</span>
        <asp:Label ID="lblUserName"
                   runat="server"
                   CssClass="style1"
                   Text="User">
        </asp:Label>
        <span class="style1">.
        <br />
        You can download or open the selected file (according the selection below), with
        double click.
        <br />
        </span>
        <asp:RadioButton ID="rbDownload"
                         runat="server"
                         Checked="True"
                         CssClass="style1"
                         GroupName="MyGroup"
                         Text="Download (Save the file to your computer)" />
        <asp:RadioButton ID="rbOpen"
                         runat="server"
                         CssClass="style1"
                         GroupName="MyGroup"
                         Text="Open (Open the file in Viewer)" />
    </p>
    <p>
          
        <telerik:RadFileExplorer ID="RadFileExplorer1"
                                 Runat="server"
                                 Skin="Office2007"
                                 OnClientFileOpen="OnClientFileOpen"
                                 EnableOpenFile="true"
                                 EnableCreateNewFolder="False"
                                 VisibleControls="TreeView, Grid, ContextMenus"
                                 style="text-align: left"
                                 Height="452px"
                                 Width="725px" >
                                 <Configuration SearchPatterns="*.*"></Configuration>
        </telerik:RadFileExplorer>
    </p>
        
    <script type="text/javascript">
            //<![CDATA[
 
            function OnClientFileOpen(oExplorer, args) {
                var item = args.get_item();
                var fileExtension = item.get_extension();
 
                var fileDownloadMode = document.getElementById("rbDownload").checked;
                if ((fileDownloadMode == true) && (fileExtension == "jpg" || fileExtension == "pdf")) {// Download the file
                    // File is a image document, do not open a new window
                    args.set_cancel(true);
 
                    // Tell browser to open file directly
                    var requestImage = "Handler.ashx?path=" + item.get_url();
                    document.location = requestImage;
                }
                setTimeout(function() {
                    var oWindowManager = oExplorer.get_windowManager();
                    var previewWinow = oWindowManager.getActiveWindow(); // Gets the current active widow
                    previewWinow.setSize(500, 500); // Set the new size of the window
                }, 100); // Some timeout is required in order to allow the window to become active
            }
            //]]>
 
    </script>
     
</asp:Content>
Daniel
Top achievements
Rank 1
 answered on 17 Feb 2011
3 answers
1.0K+ views
I am trying to open my radwindow from client-side but this window opens when I set my linkbutton onclientclick event handler, window is opening fine. But when I try to open my radwindow using Page.ClientScript I can't see my radwindow. Any help would be really appreciable. I don't want to set VisibleOnPageLoad=true because I have multiple radwindows and if any button clicks all window will appear in the screen.

        <asp:LinkButton ID="lbAddCustomer" runat="server" >
        </asp:LinkButton>

 function showWindow() {


                var oWindowCust = $find('<%= rwCustomer.ClientID %>');                
                oWindowCust.show();


                
            }  



<telerik:RadWindow ID="rwCustomer" runat="server" Title="Add Customer" VisibleStatusbar="false" OffsetElementID="lbAddCustomer" 
            Behaviors="Move,Pin,Resize" InitialBehaviors="Pin" VisibleOnPageLoad="false" Height="500" Width="510" Left="150px" 
            
            DestroyOnClose="true">
            <%--        <Shortcuts>
            <telerik:WindowShortcut CommandName="Hide" Shortcut="Esc" />
        </Shortcuts>--%>
            <ContentTemplate>
                <%--<div id="Add Customer" style="text-align: center">--%>
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td align="left" width="30%">
                            <asp:Button ID="btnCustomerCloseWindow" runat="server" Text="Close Window" CausesValidation="False" OnClientClick="return CloseCustomerWindow();"  />
                            &nbsp;
                        </td>
                        <td id="tdbtnImportCustomer" runat="server" >
                            <asp:Button ID="btnImportCustomer" runat="server" Text="Import Customer from Stock System"
                                CausesValidation="false" />
                        </td>
                        <td id="tdbtnAddCustomer" runat="server">
                            <asp:Button ID="btnAddCustomer" runat="server" Text="Add Customer" CausesValidation="false" />
                        </td>
                    </tr>
                </table>



</ContentTemplate>
        </telerik:RadWindow>

Protected Sub lbAddCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbAddCustomer.Click

Page.ClientScript.RegisterStartupScript(Me.GetType(), "key", "<script type='text/javascript'>showWindow();</script>", False)


End Sub
Svetlina Anati
Telerik team
 answered on 17 Feb 2011
1 answer
102 views
I am trying to open my radwindow from client-side but this window opens when I set my linkbutton onclientclick event handler, window is opening fine. But when I try to open my radwindow from server-side I can't see my radwindow. Any help would be really appreciable. I don't want to set VisibleOnPageLoad=true because I have multiple radwindows and if any button clicks all window will appear in the screen.

        <asp:LinkButton ID="lbAddCustomer" runat="server" >
        </asp:LinkButton>

 function showWindow() {


                var oWindowCust = $find('<%= rwCustomer.ClientID %>');                
                oWindowCust.show();


                
            }  



<telerik:RadWindow ID="rwCustomer" runat="server" Title="Add Customer" VisibleStatusbar="false" OffsetElementID="lbAddCustomer" 
            Behaviors="Move,Pin,Resize" InitialBehaviors="Pin" VisibleOnPageLoad="false" Height="500" Width="510" Left="150px" 
            
            DestroyOnClose="true">
            <%--        <Shortcuts>
            <telerik:WindowShortcut CommandName="Hide" Shortcut="Esc" />
        </Shortcuts>--%>
            <ContentTemplate>
                <%--<div id="Add Customer" style="text-align: center">--%>
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td align="left" width="30%">
                            <asp:Button ID="btnCustomerCloseWindow" runat="server" Text="Close Window" CausesValidation="False" OnClientClick="return CloseCustomerWindow();"  />
                            &nbsp;
                        </td>
                        <td id="tdbtnImportCustomer" runat="server" >
                            <asp:Button ID="btnImportCustomer" runat="server" Text="Import Customer from Stock System"
                                CausesValidation="false" />
                        </td>
                        <td id="tdbtnAddCustomer" runat="server">
                            <asp:Button ID="btnAddCustomer" runat="server" Text="Add Customer" CausesValidation="false" />
                        </td>
                    </tr>
                </table>



</ContentTemplate>
        </telerik:RadWindow>

Protected Sub lbAddCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbAddCustomer.Click

Page.ClientScript.RegisterStartupScript(Me.GetType(), "key", "<script type='text/javascript'>showWindow();</script>", False)

End Sub

Svetlina Anati
Telerik team
 answered on 17 Feb 2011
1 answer
85 views
Hi,
I am developing telerik Radscheduler in which there are multiple users who login into the scheduler.
I want to design the system in a way where one user can only insert or delete only his appointment and cannot touch other's appointment. He/she should be disabled from touching others appointments...How do I do that?
Code snippet would be appreciated.
Veronica
Telerik team
 answered on 17 Feb 2011
1 answer
120 views
Hi,

I am using extensions\wpresources\RadEditorSharePoint\4.5.4.0__1f131a624888eeed .
In moss, I want implement popup new windows for Links inside rad editor, I want to mention custom width n height (  They may chage in next developemnt)

trial -1:
I tried to use window.open directly inside radwindow  bt it didn't worked out, this piece of code striping by itself.

trial -2

I gone through  yur foum and you are using OnclientLoad javascript method for window.open 

So I tried to implement it.  see below :

On page layout 
<script type="text/javascript">
function OnClientLoad(editor)
   {
       editor.attachEventHandler ("onclick", function (e)
       {
            var sel = editor.getSelectedElement(); ; //get the currently selected element
            var href = null;
            var ele = document.getElementById("popupwindow");
if (ele)
{
if (sel.tagName == "A")
{
 href = sel.href; //get the href value of the selected link
window.open(href, null, "height=500,width=500,status=no,toolbar=no,menubar=no,location=no");
return false;
}
            }
       });
    }
    </script>

For telerik:
<telerik:RadHtmlField id="pagecontent" FieldName="PublishingPageContent" runat="server" AllowSpecialTags="true" OnClientLoad="OnClientLoad"/>

URl link will be like this, in HTML mode rad-
<div id = "popupwindow">
<a href blah blah>
</div>
But I am getting an error :
An error occurred during the processing of . Type 'Telerik.SharePoint.FieldEditor.RadHtmlField' does not have a public property named 'OnClientLoad'.

Trial -3 :

In configfile.xml :  I added <property name="OnClientLoad">OnClientLoad</property> 
still I am getting error: -> does not have a public property named 'OnClientLoad'.

Any suggestions???  Is there any way i can implement these popup links with custom width n height inside rad editor?
Stanimir
Telerik team
 answered on 17 Feb 2011
2 answers
125 views
Hi
I am using RADGrid and have 7 fields to be entered to add a record by the user.

Voucher Date
Claim type
Claim Codes
Description
Amount
VAT
TotalAmount

I have a table, tblClaimType whose data I want to populate as drop down(RadComboBox) so that user can select from the dropdown.
All i want to know is how can I do this and also on selection of ClaimType I want to Populate tblExpCodes in Claimcodes drop down.

Can anyone advice me with examples of how to do this.
Thanks
Sucheta
Daniel
Telerik team
 answered on 17 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?