Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
124 views
Hi all,
could please somebody help me with this problem?
I have RadNumericTextBox in GridTemplateColumn of RadGrid. I want two things:
- OnKeyPress it will compute differnce between its value and some start value
- OnValueChanged it will update value in database (through AJAX call)

ASPX page snippet:
<telerik:GridTemplateColumn UniqueName="colValue" HeaderText="Stav" ItemStyle-Width="35px">
    <ItemTemplate>
    <telerik:RadNumericTextBox
        ID="txtCounterValue" runat="server"  Width="80"
        MinValue="0" NumberFormat-AllowRounding="false" NumberFormat-DecimalDigits="0"
        EnabledStyle-HorizontalAlign="Right" EnabledStyle-Font-Bold="true"
        >
        <ClientEvents  OnKeyPress="CounterKeyPress"OnValueChanged="CounterValueChanged"  />
    </telerik:RadNumericTextBox>
  <div id="txtStartValue" runat="server" ></div>
    <div id="txtDifference" runat="server" ></div>
                                         
 
    </ItemTemplate>
</telerik:GridTemplateColumn>

Snippet of code-behind:
Protected Sub rgDeviceCountersDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)
            Dim myCounter = DirectCast(e.Item.DataItem, Data.DeviceCounter)
            Dim txtCounterValue As RadNumericTextBox = DirectCast(e.Item.FindControl("txtCounterValue"), RadNumericTextBox)
txtCounterValue =myCounter.StartValue
            Dim txtStartValue As HtmlGenericControl = DirectCast(e.Item.FindControl("txtStartValue"), HtmlGenericControl)
txtDtartValue.InnerText=myCounter.StartValue
            Dim txtDifference As HtmlGenericControl = DirectCast(e.Item.FindControl("txtDifference"), HtmlGenericControl)
        End Sub

Snippet of javascript:
var ajaxManager;
 
function pageLoad() {
ajaxManager = $find("<%=RadAjaxManager.GetCurrent(Page).ClientID %>");
            }

function CounterKeyPress(sender, eventArgs) {
                /* update InnerText of txtDifference with difference between RadNumericTextBox andtxtStartValue */
/* HOW TO ACHIEVE THIS? :-) */
            }

function
CounterValueChanged(sender, eventArgs) {
                /* Count difference betweentxtStartValue and txtCounterValue and call AJAX update of record (how to get Primary Id from ClientDataKeyNames?) */
ajaxManager.ajaxRequest(... AND WHAT HERE ...?);
            }





Thank you very much for your help!
Zdeněk
Top achievements
Rank 1
 answered on 10 Dec 2010
1 answer
74 views
I'm trying to export my grid to excel using the CommandItem. I'm confused because most of the examplesshow the commandItem as well as a sperate button which acutally does the Excel Export. If that is the case what good is the commandItem. I cant seem to find a C# example of how to exort to excel just using the commandItem. Can someone please point me in the right direction?

Daniel
Telerik team
 answered on 10 Dec 2010
9 answers
119 views
I have a menu that width cannot exceed 175px, I have text that need to wrap, which it cannot do in a <span>.  Is it possible to override the render method to change the <span> elements with <div> or <p> in the RadMenu?  This is possible with .NET server controls, using Control Adapters.  How would one do the same with Telerik Control.
Kevon Hayes
Top achievements
Rank 1
 answered on 10 Dec 2010
3 answers
170 views
First, let me point out that the code works perfectly on the first load. However, on the postback, the Telerik controls are not ready yet.

So I'm doing a simple loop through the grid:

var tempValue = new Array(0, 0, 0, 0, 0, 0, 0, 0);
var senderId = sender.get_id();
var telerikControl;
var grid = $find("<%= uxGrid.ClientID %>");
var rows = grid.get_masterTableView().get_dataItems();
var rowCount = rows.length; // make loop run faster
for (i = 0; i < rowCount; i++) { // foreach row
    for (j = 1; j <= 7; j++) {
        console.log(rows[i].get_element());
        telerikControl = rows[i].findControl('uxHours' + j);
        if (telerikControl == null) {
            console.log('could not find control "uxHours' + j + '" in row ' + i
                + '; updateDaySummaries initiated by ' + senderId);
        }
        if (telerikControl.get_value().length != 0) { // do NOT use greater than
            //console.log('adding ' + telerikControl.get_value() + ' from ' + telerikControl.get_id() + ' to tempValue[' + (j - 1) + ']:' + tempValue[j - 1]);
            tempValue[j - 1] += telerikControl.get_value();
        }
    }
}

See the line where I call console.log(rows[i].get_element()); ?

Here is a sample of the difference between the first page load (which works) and the postback.

broken code (line 83):
<div style="z-index: 6000;" class="rcbSlide"><div style="display: none; width: 175px;" class="RadComboBoxDropDown RadComboBoxDropDown_Default " id="ctl00_bodyContentPlaceHolder_uxContainer_uxGrid_ctl00_ctl04_uxServiceList_dropDown_DropDown"><div style="height: 150px; width: 100%;" class="rcbScroll rcbWidth"><ul style="list-style: none outside none; margin: 0pt; padding: 0pt;" class="rcbList"><li class="rcbItem ">Business Development</li></ul></div></div></div><input type="hidden" name="ctl00_bodyContentPlaceHolder_uxContainer_uxGrid_ctl00_ctl04_uxServiceList_dropDown_ClientState" id="ctl00_bodyContentPlaceHolder_uxContainer_uxGrid_ctl00_ctl04_uxServiceList_dropDown_ClientState" autocomplete="off" value="{"logEntries":[],"value":"16","text":"Business Development","enabled":true}">

working code (line 83):
<input type="hidden" name="ctl00_bodyContentPlaceHolder_uxContainer_uxGrid_ctl00_ctl04_uxServiceList_dropDown_ClientState" id="ctl00_bodyContentPlaceHolder_uxContainer_uxGrid_ctl00_ctl04_uxServiceList_dropDown_ClientState" autocomplete="off" value="{"logEntries":[],"value":"16","text":"Business Development","enabled":true}">

Any ideas?




Iana Tsolova
Telerik team
 answered on 10 Dec 2010
1 answer
51 views
See attached screenshot.

I've been asked to duplicate this functionality and I am trying to figure out how they did it and if it's possible with either Grid or TreeList.
Iana Tsolova
Telerik team
 answered on 10 Dec 2010
1 answer
106 views
I am new to Telerik, but I have a problem.  I support an existing .NET application, which onclick of the Save button, once the data was save to the DB, a StartupScript was registered, which created an alert box, that told the user the data was saved.  I modified in the code behind that onclick of the Save button instead of Saving I pop up a Telerik Window and once the user has finished and closed this window, Saving should continue and thereby the same alert window should pop up and let the user know that their data has been saved.  Unfortunately, this doesn't happen the Javascript alert window is  never displayed, it seems as if the AjaxManager is in control and just ignores this, script.  I know this can be changed to a RadAlert, but unfortunately this window looks totally different from the alert window the user will not be happy with this.  Is there anyway I can still call the StartupScript that creates the JavaScript Alert window?

Thanks in advance for any help you can give.

Marcia
Georgi Tunev
Telerik team
 answered on 10 Dec 2010
16 answers
348 views
This help topic, http://www.telerik.com/help/aspnet-ajax/grddefaultbehavior.html, says ShowExportToExcelButton can be set on CommandItemSettings to display the export to excel button.  However, It does not work with the latest library I have.  Any thoughts?
Pavlina
Telerik team
 answered on 10 Dec 2010
3 answers
259 views
How can expand and collapse icons at right hand side in PanelBar item be changed? Please see attached screen shot for visual.

Thank you.
Amit
Top achievements
Rank 1
 answered on 10 Dec 2010
1 answer
103 views
Hello,
as far as I see it give no German-Localizations-Files for grid, filter, pager, Upload and other controls.
Resources is expected in the near future to this?

Greetings
Daniel
Telerik team
 answered on 10 Dec 2010
2 answers
206 views
I know the file explorer is an ASP.NET control, but much of the code needed is javascript and I'm just not any good with that.  So here's my noob question.  I have a video player control that embeds a windows media player on my page.  I have a File Explorer control above it showing the contents of a Video Library folder where the user is asked to double-click a filename and I want it to play in my video player.  From the OnClientItemSelected(sender, args) javascript function, can I call a function in my ASP code-behind page? Or is there a simpler/easier way to do this?  I need to take the selected filename and fill in the 'VideoURL' field of the video player control.

I have tried several different ways to do this with no luck and I'm getting frustrated.  I know this should be a simple task but I just don't get it.

Here is the code in my primary .aspx page.  There is nothing in the .aspx.vb page yet.

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <script type="text/javascript">
       
       function OnClientItemSelected(sender, args) {
           var vidpath = args.get_item().get_name();
           PlayVid(vidpath);
       }

    </script>


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

        Select a file below to view it.<br /><br />


        <telerik:RadFileExplorer
            ID="RadFileExplorer1" 
            runat="server" 
            Height="250px" 
            InitialPath="/VideoLibrary" Skin="Outlook" EnableCreateNewFolder="False" 
            ToolTip="Double-click a video from the list to view it." TreePaneWidth="0px" 
            VisibleControls="Grid, ContextMenus" 
            onclientitemselected="OnClientItemSelected" Width="606px">
                <Configuration SearchPatterns="*.*" 
                ViewPaths="/VideoLibrary">
                </Configuration>
        </telerik:RadFileExplorer>

        <br /><br />

    <ASPNetVideo:WindowsMedia ID="WindowsMedia1" runat="server" Height="480px" 
            VideoURL="http://www.pdcrx.com/VideoLibrary/Introduction_to_Palliative_Sedation_-_Aug_2010.wmv" 
            Width="640px" WMode="Window">
    </ASPNetVideo:WindowsMedia>

    </form>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <script type="text/javascript">
       
       function OnClientItemSelected(sender, args) {
           var vidpath = args.get_item().get_name();
           PlayVid(vidpath);
       }

    </script>


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

        Select a file below to view it.<br /><br />


        <telerik:RadFileExplorer
            ID="RadFileExplorer1" 
            runat="server" 
            Height="250px" 
            InitialPath="/VideoLibrary" Skin="Outlook" EnableCreateNewFolder="False" 
            ToolTip="Double-click a video from the list to view it." TreePaneWidth="0px" 
            VisibleControls="Grid, ContextMenus" 
            onclientitemselected="OnClientItemSelected" Width="606px">
                <Configuration SearchPatterns="*.*" 
                ViewPaths="/VideoLibrary">
                </Configuration>
        </telerik:RadFileExplorer>

        <br /><br />

    <ASPNetVideo:WindowsMedia ID="WindowsMedia1" runat="server" Height="480px" 
            VideoURL="http://www.pdcrx.com/VideoLibrary/Introduction_to_Palliative_Sedation_-_Aug_2010.wmv" 
            Width="640px" WMode="Window">
    </ASPNetVideo:WindowsMedia>

    </form>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <script type="text/javascript">
       
       function OnClientItemSelected(sender, args) {
           var vidpath = args.get_item().get_name();
           PlayVid(vidpath);
       }

    </script>


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

        Select a file below to view it.<br /><br />


        <telerik:RadFileExplorer
            ID="RadFileExplorer1" 
            runat="server" 
            Height="250px" 
            InitialPath="/VideoLibrary" Skin="Outlook" EnableCreateNewFolder="False" 
            ToolTip="Double-click a video from the list to view it." TreePaneWidth="0px" 
            VisibleControls="Grid, ContextMenus" 
            onclientitemselected="OnClientItemSelected" Width="606px">
                <Configuration SearchPatterns="*.*" 
                ViewPaths="/VideoLibrary">
                </Configuration>
        </telerik:RadFileExplorer>

        <br /><br />

    <ASPNetVideo:WindowsMedia ID="WindowsMedia1" runat="server" Height="480px" 
            VideoURL="http://www.pdcrx.com/VideoLibrary/Introduction_to_Palliative_Sedation_-_Aug_2010.wmv" 
            Width="640px" WMode="Window">
    </ASPNetVideo:WindowsMedia>

    </form>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <script type="text/javascript">
        
       function OnClientItemSelected(sender, args) {
           var vidpath = args.get_item().get_name();
           PlayVid(vidpath);  <-- This is where I was thinking of calling a code-behind vb function
       }
 
    </script>
 
 
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
 
        Select a file below to view it.<br /><br />
 
 
        <telerik:RadFileExplorer
            ID="RadFileExplorer1"
            runat="server"
            Height="250px"
            InitialPath="/VideoLibrary" Skin="Outlook" EnableCreateNewFolder="False"
            ToolTip="Double-click a video from the list to view it." TreePaneWidth="0px"
            VisibleControls="Grid, ContextMenus"
            onclientitemselected="OnClientItemSelected" Width="606px">
                <Configuration SearchPatterns="*.*"
                ViewPaths="/VideoLibrary">
                </Configuration>
        </telerik:RadFileExplorer>
 
        <br /><br />
 
    <ASPNetVideo:WindowsMedia ID="WindowsMedia1" runat="server" Height="480px"
            VideoURL="some_video_title.wmv"
            Width="640px" WMode="Window">
    </ASPNetVideo:WindowsMedia>
 
    </form>
</asp:Content>
Dobromir
Telerik team
 answered on 10 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?