Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
96 views
Hi,

1.  My page has many controls, I have surrounded logical UI groups of controls into asp:Panels and am using this outer Panel as the updated control in the ajaxmanager configuration.  Is this correct? Or do I have to define the links to all lower level controls?

i.e. 

<telerik:AjaxSetting AjaxControlID="compareproductLinkButton">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="toprowPanel" />
                    <telerik:AjaxUpdatedControl ControlID="deptLiteral" />
                    <telerik:AjaxUpdatedControl ControlID="resultsPanel" />
                    <telerik:AjaxUpdatedControl ControlID="relatedcatsPanel" />
                    <telerik:AjaxUpdatedControl ControlID="activefilterPanel" />
                </UpdatedControls>
</telerik:AjaxSetting>

... etc

The reason I wanted to check is that on a given ajax postback a literal control in one of the panels is not updating even though in debug I can see the code being run.  And I am seeing a few things dissappear on certain ajax postbacks.

2. If I define a control as part of an ajaxmanager relationship then its css style at run-time drops into block level (or something happens to change our css, I assume it is surrounded by a div for ajax update), how can I stop this happening?

Thank you
Matt
Matt
Top achievements
Rank 1
 answered on 02 Jul 2011
6 answers
111 views
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
                        EnablePageHeadUpdate="False">
                        <AjaxSettings>
                            <telerik:AjaxSetting AjaxControlID="lnkbutton">
                                <UpdatedControls>
                                    <telerik:AjaxUpdatedControl ControlID="RadTreeView1" />
                                </UpdatedControls>
                            </telerik:AjaxSetting>
                        </AjaxSettings>
                    </telerik:RadAjaxManager>

lnkbutton is the ID of button which is in RadTreeview1 .
<telerik:RadTreeNode  Value="pcomment">
                    <NodeTemplate>
                    <telerik:RadTextBox  runat="server" Width="250px" ID="postcomment"></telerik:RadTextBox>
                    <asp:Button Text="Post" runat="server" ID="lnkbutton" onclick="lnkbutton_Click" ></asp:Button>
                    </NodeTemplate>
                    </telerik:RadTreeNode>
Code - Behind
protected void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e)
   {
 
       string getc = "SELECT  [User].Name, [User].ID, Comments.ID AS CID, Comments.Comment, Comments.ItemID, Comments.UID, [User].T28 FROM            [User] INNER JOIN Comments ON [User].ID = Comments.UID WHERE        (Comments.ItemID = 271)";
       dt = dbClass.ReturnDT(getc);
       if (dt.Rows.Count > 0)
       {
            
           int n = dt.Rows.Count;
           for (int m = 0; m < n; m++)
           {
               RadTreeNode onDemandNode = new RadTreeNode();
               onDemandNode.ImageUrl = dt.Rows[m]["T28"].ToString();
               onDemandNode.Text = "<u><b><a href='Profile/profile.aspx?Id="+dt.Rows[m]["ID"].ToString()+"'>"+dt.Rows[m]["Name"].ToString()+"</a></b></u>  "+ dt.Rows[m]["Comment"].ToString();
                
               onDemandNode.ExpandMode = TreeNodeExpandMode.ClientSide;
               //Add the node as a child of the currently expanded node
               RadTreeView1.Nodes.FindNodeByText("Comments").Nodes.Add(onDemandNode);
           }
            
       }
     }
 protected void lnkbutton_Click(object sender, EventArgs e)
    {
       RadTextBox tb=  (RadTextBox)RadTreeView1.Nodes.FindNodeByValue("pcomment").FindControl("postcomment");
       string insertcomment = " INSERT INTO Comments (ItemID, UID, Comment) VALUES  (271, "+Session["UserId"]+", '"+tb.Text+"')";
       dbClass.DataBase(insertcomment);
      
    }
What I want is ,whenever the user clicks the button post that is the button with ID lnkbutton , the RadTreeView1 gets refreshed  (without reloading the whole page again) , what should i do to achieve this ??
dotnetrockerzzz
Top achievements
Rank 2
 answered on 02 Jul 2011
2 answers
119 views
Hi,
When radgrid.gridlines  is set to both, radgrid has double border (see attached image) on firefox, safari and chrome. But if radgrid.gridlines  is set to none, the export excel file does not have border among its cells. How to solve this problem? Thanks.
york
Top achievements
Rank 1
 answered on 02 Jul 2011
3 answers
1.0K+ views
I am new to .net and Telerik controls.

I am trying to do this technique, but using the radgrid.

http://msdn.microsoft.com/en-us/library/aa992036%28VS.80%29.aspx

However, I need to loop through each row in this grid and update with the selected values.

Any help or ideas would be great.

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:AR_ManagementConnectionString %>"
        SelectCommand="SELECT * FROM [AR_QA_Details] WHERE (([iUserID] = @iUserID) AND ([sSiteID] = @sSiteID) AND ([sAcct] = @sAcct) AND ([IssueName] = @IssueName)) ORDER BY [StepNumber]">
        <SelectParameters>
            <asp:Parameter DefaultValue="111" Name="iUserID" Type="Int32" />
            <asp:Parameter DefaultValue="108002" Name="sSiteID" Type="String" />
            <asp:Parameter DefaultValue="295856" Name="sAcct" Type="String" />
            <asp:Parameter DefaultValue="Coding" Name="IssueName" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
 
 
 
 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"
        GridLines="None">
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
 
 
    <Columns>
        <telerik:GridBoundColumn DataField="Step" HeaderText="Step"
            SortExpression="Step" UniqueName="Step">
            <HeaderStyle Width="350px" />
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn DataField="Critical" DataType="System.Int32"
            HeaderText="Critical" SortExpression="Critical" UniqueName="Critical">
            <EditItemTemplate>
                <asp:TextBox ID="CriticalTextBox" runat="server" Text='<%# Bind("Critical") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:CheckBox ID="CriticalCheckBox" runat="server" Checked='<%# Eval("Critical") %>' />
            </ItemTemplate>
            <FooterStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
            <HeaderStyle Width="50px" Font-Bold="False" Font-Italic="False"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                HorizontalAlign="Center" Wrap="True" />
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="Pass" DataType="System.Int32"
            HeaderText="Pass" SortExpression="Pass" UniqueName="Pass">
            <EditItemTemplate>
                <asp:TextBox ID="PassTextBox" runat="server" Text='<%# Bind("Pass") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:RadioButton ID="PassRadioButton" GroupName="PassFailNA" runat="server" Checked='<%# Eval("Pass") %>' />
            </ItemTemplate>
            <FooterStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
            <HeaderStyle Width="50px" Font-Bold="False" Font-Italic="False"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                HorizontalAlign="Center" Wrap="True" />
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="Fail" DataType="System.Int32"
            HeaderText="Fail" SortExpression="Fail" UniqueName="Fail">
            <EditItemTemplate>
                <asp:TextBox ID="FailTextBox" runat="server" Text='<%# Bind("Fail") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:RadioButton ID="FailRadioButton" GroupName="PassFailNA" runat="server" Checked='<%# Eval("Fail") %>' />
            </ItemTemplate>
            <FooterStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
            <HeaderStyle Width="50px" Font-Bold="False" Font-Italic="False"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                HorizontalAlign="Center" Wrap="True" />
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="NA" DataType="System.Int32"
            HeaderText="NA" SortExpression="NA" UniqueName="NA">
            <EditItemTemplate>
                <asp:TextBox ID="NATextBox" runat="server" Text='<%# Bind("NA") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:RadioButton ID="NARadioButton" GroupName="PassFailNA" runat="server" Checked='<%# Eval("NA") %>' />
            </ItemTemplate>
            <FooterStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
            <HeaderStyle Width="50px" Font-Bold="False" Font-Italic="False"
                Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                HorizontalAlign="Center" Wrap="True" />
            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                Wrap="True" />
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn DataField="Notes" HeaderText="Notes"
            SortExpression="Notes" UniqueName="Notes">
            <EditItemTemplate>
                <asp:TextBox ID="NotesTextBox" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:TextBox ID="NotesTextBox" runat="server" TextMode="Multiline"  Rows="2" Columns="50" Text='<%# Bind("Notes") %>'></asp:TextBox>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
    </Columns>
</MasterTableView>
    </telerik:RadGrid>
    <asp:Button ID="SaveButton" runat="server" Text="Save" />


Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Jul 2011
4 answers
145 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
498 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
381 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
134 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
85 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
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?