Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
152 views
Dear All,

Please let me know if its possible to open RadWindow using severside code from  Application_start event of Global.asax. I am trying to open the radwindow in a callback method of cache item whenever the cache item expires. Please find the code below for your reference. Any help will be appreciated.

Regards,
Noor Hussain
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
        RegisterCacheEntry()
    End Sub
 
''' <summary>
    ''' Register a cache entry which expires in 1 minute and gives us a callback.
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub RegisterCacheEntry()
        ' Prevent duplicate key addition
        If HttpContext.Current.Cache(DummyCacheItemKey) IsNot Nothing Then
            Return
        End If
 
        HttpContext.Current.Cache.Add(DummyCacheItemKey, "Test", Nothing, DateTime.MaxValue, TimeSpan.FromMinutes(1), CacheItemPriority.NotRemovable, _
         New CacheItemRemovedCallback(AddressOf CacheItemRemovedCallback))
    End Sub
 
    ''' <summary>
    ''' Callback method which gets invoked whenever the cache entry expires.
    ''' We can do our "service" works here.
    ''' </summary>
    ''' <param name="key"></param>
    ''' <param name="value"></param>
    ''' <param name="reason"></param>
    Public Sub CacheItemRemovedCallback(ByVal key As String, ByVal value As Object, ByVal reason As CacheItemRemovedReason)
        Debug.WriteLine("Cache item callback: " & DateTime.Now.ToString())
 
        ' Do the service works
        DoWork()
 
        ' We need to register another cache item which will expire again in one
        ' minute. However, as this callback occurs without any HttpContext, we do not
        ' have access to HttpContext and thus cannot access the Cache object. The
        ' only way we can access HttpContext is when a request is being processed which
        ' means a webpage is hit. So, we need to simulate a web page hit and then
        ' add the cache item.
        HitPage()
    End Sub
 
    ''' <summary>
    ''' Hits a local webpage in order to add another expiring item in cache
    ''' </summary>
    Private Sub HitPage()
        Dim client As New WebClient()
        client.DownloadData(DummyPageUrl)
    End Sub
 
    ''' <summary>
    ''' Asynchronously do the 'service' works
    ''' </summary>
    Private Sub DoWork()
        Debug.WriteLine("Begin DoWork...")
        Debug.WriteLine("Running as: " + WindowsIdentity.GetCurrent().Name)
 
 
       
        Dim RadWindowManager1 As New RadWindowManager
        
 
 
        'Set the same height to all windows
        RadWindowManager1.Height = Unit.Pixel(250)
 
 
        'Add shortcuts to radwindow manager clientside commands
        RadWindowManager1.Shortcuts.Add(New WindowShortcut("MinimizeAll", "ALT+F2"))
        RadWindowManager1.Shortcuts.Add(New WindowShortcut("RestoreAll", "ALT+F3"))
 
        'Create a new window add it dynamically
 
        'The window will inherit the default settings of parent WindowManager
        Dim newWindow As New RadWindow()
        newWindow.NavigateUrl = "www.google.com"
 
         
 
        
 
        'Top and Left can be used in conjunction with the OffsetElementId (if no OffsetElementId is specified, the top left corner of the browser window is used
        newWindow.Top = Unit.Pixel(22)
        newWindow.Left = Unit.Pixel(0)
 
        'Add the newly created RadWindow to the RadWindowManager's collection
        RadWindowManager1.Windows.Add(newWindow)
 
 
        'Get a reference to the first window in the list
        Dim firstWindow As RadWindow = RadWindowManager1.Windows(0)
        'alternative:
        'Telerik.WebControls.RadWindow mywindow = RadWindowManager1.Windows["RadWindowServer"];
 
 
 
        'Set its navigate URl to be different
        firstWindow.NavigateUrl = "www.google.com"
        firstWindow.VisibleOnPageLoad = True
 
         
        
 
        Debug.WriteLine("End DoWork...")
    End Sub
Noor hussain
Top achievements
Rank 1
 answered on 02 Jul 2011
2 answers
506 views
Hi,

Please let me know how to access the BrowserWindow (Parent Page ) control events from child RadWindow.
I have a RadMenu with two child menuitems and a radwindowmanager on my ParentPage.  On Click of first child radmenuitem I am opening a radwindow using the ParentPage RadWindowManager. Now in this Child radwindow I have a button, On this button click i want to simulate the RadMenuItem click event for the second child radmenuitem.  I m using the below javascript code to get the reference of the RadMenu of the Browser
var oRadMenu = GetRadWindow().BrowserWindow.document.getElementById('RadMenu1');
var item = oRadMenu.findItemByText(text);
Window (Parent Page)
, but I am unable to get the particular child radmenuitem. So that I can execute its click event. Any help is appreciated.

Regards,
Noor Hussain
Noor hussain
Top achievements
Rank 1
 answered on 02 Jul 2011
5 answers
385 views
Hi,

I have a column field in SQL Server database which is a string file, which contain phone number (11 digits, for example: 12223334444). In RadGrid, I used following code to format the number to display in RadGrid as a proper telephone number:

 

protected void RadGridResult_ItemDataBound(object sender, GridItemEventArgs e)

{

    //Format string to phone number.

    if (e.Item is GridDataItem)

     {

 

         GridDataItem item = (GridDataItem) e.Item;

        Object ob = item["ConfirmationLogPhone"].Text;

        if (!Convert.IsDBNull(ob))

         {

 

                Int64 iParsedValue = 0;

                if (Int64.TryParse(ob.ToString(), out iParsedValue))

                 {

                        TableCell cell = item["ConfirmationLogPhone"];

                         cell.Text =

                String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:#-(###) ###-####}", new object[] { iParsedValue });

                 }

         }

     }

}

 

However, when I export the grid to excel, the number is display merely just a string (Ex: 12223334444). MS Excel even report error that "Number stored as text field" on every cell in the column.

Would you please tell me how to format and export string of telephone number to excel properly?

Thanks

LamK
Daniel
Telerik team
 answered on 01 Jul 2011
1 answer
140 views
I have an aspx page with 2 RadListBox controls.  AllowTransfer = true for RadListBox1.  RadListBox1 gets populated from a database and is also tied to a TextBox used as a filter. 

After transfering items from RadListBox1 to RadListBox2 by clicking the client-side arrow button that gets displayed with RadListBox1 I can see the items on the client side of RadListBox2. but these items are not accessible on the server side. 

I need to get server-side access the new items in RadListbox2 during a postback in order to pass them to another method ... but the server-side items colleciton is empty.

Setting a breakpont I do see a value in RadListBox2.ClientChanges ... and an array like this:

>? RadListBox2.ClientChanges

Count = 2

[0]: {Telerik.Web.UI.ClientOperation<Telerik.Web.UI.RadListBoxItem>}

[1]: {Telerik.Web.UI.ClientOperation<Telerik.Web.UI.RadListBoxItem>}

Is there a way to access these items in a server side postback?  Thanks

Steve
Top achievements
Rank 1
 answered on 01 Jul 2011
2 answers
90 views
Is it possible to keep the word being spell checked visible when going to the Changed Manually option textbox when using the spellchecker?  This would make it so the user can see the original word, while also being able to change it in the Changed Manually textbox.

Thank you for your help.

Aaron
Aaron
Top achievements
Rank 1
 answered on 01 Jul 2011
6 answers
1.3K+ views
Hi,

I am trying to disable a submit button from the client side. I am using the following code:
function OkClicked(sender, args) {
 
           document.getElementById("<%=btnConfirm.ClientID %>").set_enabled(false);
 
        }

This is the markup for the button:
<telerik:RadButton ID="btnConfirm" runat="server" OnClick="btnConfirm_Click" Enabled="true">
<Icon SecondaryIconCssClass="rbOk" SecondaryIconRight="4" SecondaryIconTop="4" />
</telerik:RadButton>

When the button gets clicked it deosn't get disabled, but does a postback.I also tried the following script:
document.getElementById("<%=btnConfirm.ClientID %>").disabled = true;

In this case the button APPEARS disabled, but still responds to clicks and any other events (like hover).

What's going on here?

v
Viktor Takacs
Top achievements
Rank 2
 answered on 01 Jul 2011
3 answers
71 views
I've followed the example at http://demos.telerik.com/aspnet-ajax/panelbar/examples/populatingwithdata/databindings/defaultvb.aspx to add a RadPanelBar and RadPanelItems to a SharePoint 2010 page without any success. The RadPanelBar doesn't show on the page when I give values to DataFieldID & DataFieldParentID. No error given. When I leave those properties blank and set DataTextField="Title" then I get the menu but only the 1st level.

Instead of an SQLDataSource I'm using an SPDataSource. The spdatasource does work however, with an asp:DropDownList control.

Are there issues with RadpanelBar and SPDataSource?
Kalina
Telerik team
 answered on 01 Jul 2011
9 answers
274 views
Hello,

I have a tab strip of five tabs, each has a user control dynamically loaded into a corresponding multi page.  Each of the user control's has it's own validation, and when I click a button that causes validation, I only want it to validate that particular user control, with javascript.  Everything is set up properly as far as the validation controls, but every tab validates when I only want the currently selected tab to validate.  Can anyone help me on this?
Rory
Top achievements
Rank 1
 answered on 01 Jul 2011
3 answers
121 views
Hey guys...hope you can help with this one.

I've got a RadTreeView control inside a fieldset. For the purposes of this request I cannot change how the project is organized :)  The problem is, in IE only of course, the TreeView overlaps content below the fieldset as it is expanded (image attached).

This problem goes away if I remove the fieldset! Is there any redraw or refresh events that I can trigger on the TreeView that will solve this issue?

Occurs in IE8 in both regular and compatibility modes. 

Ivan Zhekov
Telerik team
 answered on 01 Jul 2011
2 answers
38 views

Hello,

I've added 9900 + words to the default .TDF dictionary file using the Dictionary Configurator downloaded from another forum here at Telerik.

While testing some of the words, all medical in nature, I don't seem to have consistent suggestions.

For example I enter
zygapophy and I should get zygapophyseal, zygapophyses, and zygapophysis as suggestions but I only receive the last two. In my dictionary I have the following entries:

zygapophyses:SKPF:SKPF
zygapophysis:SKPF:SKPF
zygapophyseal:SKPF:SKPF

I have a total of 159,596 words in the default .TDF file. Using the Custom Dictionary is not an option because of my security/network set up.

I loaded a list of words into a word document with a .TXT extension then used the Dictionary Configurator to load all of them to the existing .TDF list - this was successful. I used the DC to test this same scenario and it works perfectly but in my application I'm experiencing the issue I stated above - missing zygapophyseal from the suggestion list.

I assume the spell checker uses the second and third columns to help group words for the suggestion list, but in this case it seems not to work correctly.

Have any ideas/suggestions?

Thanks in advance,

Dan

PS. I'm using VS.Net 2008 and C#

Dan
Top achievements
Rank 1
 answered on 01 Jul 2011
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
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
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?