Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
211 views
I currently have a webpage that Inherits from a basePage class. Within the basePage class, I have some code to register an event handler for all unhandled errors on the web page, as seen below :

  protected override void OnInit(EventArgs e){
      // Trap any unhandled exceptions and log them.
      Error += BasePage_Error;
      base.OnInit(e);
    }

  private void BasePage_Error(object sender, EventArgs e){
      Exception ex = Server.GetLastError();
      int errorID = LogException(ex);
      Server.ClearError();
      Response.Redirect(Page.ResolveUrl(string.Format("~/Error.aspx?ReferenceNumber={0}", errorID)));
    }


The problem comes in after I add in an RadAjax panel to the main page and surround my current form with the AjaxPanel. If some unhandled error ends up going to BasePage_Error routine, when it goes to the Response.Redirect line I get the following javascript error on the browser:

Line: 4723
Error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.

The Response.Redirect command is somehow causing issues, but only when I have the AjaxPanel on the page. If I remove the panel, and run into the same issue, the Response.Redirect line works perfectly. Does anyone have an idea on what I can be doing wrong, or how to fix this issue?
Kevin Kess
Top achievements
Rank 1
 answered on 26 May 2010
2 answers
256 views
i keep getting this error at random times. it's rarely with the same file and I can't seem to get it to happen consistently. I have no idea why it is happening but whenever it does it freezes the upload.

it happens at this line of code

"if(c(o.rowElement).parents().length==0){return;0}"

inside the telerik control's web resource
Daniel Gioulakis
Top achievements
Rank 1
 answered on 26 May 2010
2 answers
280 views
I'm trying to get a reference to a RadComboBox with a nested RadTreeView inside of a RadGrid.  I've been following your example at http://www.telerik.com/community/forums/aspnet-ajax/grid/client-side-find-control-problem.aspx which suggests using the findControl method: 

var comboBox = $telerik.findControl(parentElement, "RadComboBox1");

but this method is only returning a reference to the first instance of the combobox in the grid, not the selected record.  Seems like it would be pretty useless without someway of detecting the selected record but I cannot find any examples of how to do this.  I've tried getting a handle on the selected_Items() of the grid but that isn't working for me either.  I'm not the best at javascripting so it could be a syntax issue. 

Here's my sample script.  Currently, this code just updates the combo box text in the first row of the grid, regardless of which combobox/row i'm selecting from.  The function that's failing is nodeClicking().  Any assistance would be greatly appreciated:

 

<script type="text/javascript">  
 
function RowDblClick(sender, eventArgs) {  
 
sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());  
 
}  
 
 
 
function nodeClicking(sender, args) {  
 
if (sender.get_id().indexOf("tvAdjCategory") != -1) {  
 
var comboBox = $find("<%= cboAdjCategory.ClientID %>");  
 
}  
 
else {  
 
var radGrid = $find('<%= gvWalletTransactions.ClientID %>');  
 
var comboBox = $telerik.findControl(radGrid.get_element(), "cboCategory");  
 
}  
 
 
var node = args.get_node()  
 
comboBox.set_text(node.get_text());  
 
comboBox.trackChanges();  
 
comboBox.get_items().getItem(0).set_value(node.get_text());  
 
comboBox.commitChanges();  
 
comboBox.hideDropDown();  
 
}  
 
function StopPropagation(e)  
 
{  
 
if(!e)  
 
{  
 
e = window.event;  
 
}  
 
e.cancelBubble = true;  
 
}  
 
 
function OnClientDropDownOpenedHandler(sender, eventArgs) {  
 
if (sender.get_id().indexOf("cboAdjCategory") != -1) {  
 
var treeName = "tvAdjCategory";  
 
}  
 
else {  
 
var treeName = "tvCategory";  
 
}  
 
 
var tree = sender.get_items().getItem(0).findControl(treeName)  
 
var selectedNode = tree.get_selectedNode();  
 
if (selectedNode)  
 
{  
 
selectedNode.scrollIntoView();  
 
}  
 
}  
 
function OnLoad(sender, args) {  
 
var combo = sender;  
 
var input = combo.get_inputDomElement();  
 
input.onkeydown = onKeyDownHandler;  
 
}  
 
function onKeyDownHandler(e) {  
 
if (!e)  
 
e = window.event;  
 
// handle all keys except tab (keycode 9) other keys can be captured   
 
if (e.keyCode != '9') {  
 
e.returnValue = false;  
 
if (e.preventDefault) {  
 
e.preventDefault();  
 
}  
 
}  
 
}   
 
 
</script> 
 

 

Here's a sample of my grid:

 

 <telerik:RadGrid ID="gvWalletTransactions" runat="server" AllowSorting="True" meta:resourcekey="gvTransactions" 
                    AutoGenerateColumns="False" skin="Vista" font-size="X-Small" GridLines="None"   
                    AllowPaging="True">                                          
                        <MasterTableView DataKeyNames="TransactionID" GridLines="Both">  
                            <Columns> 
                                <telerik:GridBoundColumn DataField="TransactionID" Display="False"   
                                    HeaderText="TransactionID" UniqueName="TransactionID" Visible="False">  
                                </telerik:GridBoundColumn> 
                                    <telerik:GridTemplateColumn DataField="TransactionDate" HeaderText="Date"   
                                    UniqueName="TransactionDate">  
                                    <ItemTemplate> 
                                        <telerik:RadDatePicker ID="dtDate" runat="server" AutoPostBack="True" Skin="Vista" 
                                            Culture="English (United States)" ShowPopupOnFocus="True" Width="60px"   
                                            SelectedDate='<%# Bind("TransactionDate", "{0:d}") %>' EnableEmbeddedBaseStylesheet="False" CssClass="TextBoxAsLabel" > 
                                            <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"   
                                            ShowRowHeaders="false" FirstDayOfWeek="Sunday" /> 
                                            <DatePopupButton visible="False" HoverImageUrl="" ImageUrl="" /> 
                                            <DateInput DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy"   
                                                EnableEmbeddedBaseStylesheet="False" CssClass="TextBoxAsLabel"  AutoPostBack="True" SelectionOnFocus="SelectAll">  
                                            </DateInput> 
                                        </telerik:RadDatePicker> 
                                    </ItemTemplate> 
                                    <ItemStyle HorizontalAlign="Center"/>  
                                </telerik:GridTemplateColumn> 
                               <telerik:GridTemplateColumn DataField="Description" HeaderText="Description"   
                                    UniqueName="Description">  
                                    <ItemTemplate> 
                                        <Telerik:RadTextBox ID="txtDescription" runat="server"  width="250px" 
                                            Text='<%# Bind("Description") %>' CssClass="TextBoxAsLabel" Skin="Vista" 
                                            EnableEmbeddedBaseStylesheet="False" SelectionOnFocus="SelectAll" /> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                               <telerik:GridTemplateColumn DataField="Amount"   
                                    HeaderText="Amount" UniqueName="Amount" SortExpression="Amount">  
                                    <ItemTemplate> 
                                        <telerik:RadNumericTextBox ID="txtAmount" Runat="server" Skin="Vista" 
                                        Culture="English (United States)" Type="Currency" SelectionOnFocus="SelectAll" 
                                        Value='<%# Bind("Amount", "{0:C}") %>' CssClass="TextBoxAsLabel" Width="50px">  
                                        </telerik:RadNumericTextBox> 
                                    </ItemTemplate> 
                                    <ItemStyle HorizontalAlign="Center"/>  
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn HeaderText="Category" UniqueName="Category" > 
                                    <ItemTemplate> 
                                        <telerik:RadComboBox ID="cboCategory" runat="server" Skin="Vista" 
                                        OnClientDropDownOpened="OnClientDropDownOpenedHandler"   
                                        meta:resourcekey="cboCategory" Width="110px" DropDownWidth="200px">  
                                            <ItemTemplate> 
                                                <telerik:RadTreeView ID="tvCategory" runat="server" Skin="Vista" 
                                                OnClientNodeClicking="nodeClicking" > 
                                                </telerik:RadTreeView> 
                                            </ItemTemplate> 
                                            <Items> 
                                               <telerik:RadComboBoxItem Value="0"/>  
                                           </Items> 
                                        </telerik:RadComboBox> 
                                    </ItemTemplate> 
                                    <ItemStyle Wrap="False" HorizontalAlign="Center"/>  
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn HeaderText="Project" UniqueName="Project"   
                                    DataField="Project">  
                                     <ItemTemplate> 
                                        <telerik:RadComboBox runat="server" ID="cboProject" Skin="Vista" DropDownWidth="200px" 
                                        meta:resourcekey="cboProject" AppendDataBoundItems="true" Width="100px">  
                                            <Items> 
                                                <telerik:RadComboBoxItem Value="0" /> 
                                            </Items> 
                                        </telerik:RadComboBox> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn UniqueName="Account" HeaderText="Account"   
                                    DataField="ToFromAccount">  
                                    <ItemTemplate> 
                                        <telerik:RadComboBox runat="server" ID="cboAccount" Skin="Vista" Width="100px" 
                                        DropDownWidth="200px" meta:resourcekey="cboAccount" AppendDataBoundItems="true" > 
                                            <Items> 
                                                <telerik:RadComboBoxItem Value="0" /> 
                                            </Items> 
                                        </telerik:RadComboBox> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                                <telerik:GridTemplateColumn DataField="Flagged" UniqueName="Flagged">  
                                    <ItemTemplate> 
                                        <asp:ImageButton ID="btnFlagged" runat="server" meta:resourcekey="btnFlagged" onclick="imgFlagged_Click" /> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
                            </Columns> 
                            <EditFormSettings UserControlName="~/TransactionPages/UserControls/TransactionDetail.ascx" EditFormType="WebUserControl"/>  
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Font-Italic="False" Font-Overline="False" Font-Size="Medium" Font-Strikeout="False" Font-Underline="False" /> 
                        </MasterTableView> 
                        <ClientSettings EnableRowHoverStyle="True">  
                            <Selecting AllowRowSelect="True" /> 
                            <ClientEvents OnRowDblClick="RowDblClick" /> 
                        </ClientSettings> 
                    </telerik:RadGrid>   

Aimee Rasmussen
Top achievements
Rank 1
 answered on 26 May 2010
3 answers
137 views
I wish to disable a combobox and all its items using client side script. I've read all the documentation about how I should do this but whenever I try to call the disable() method I get an error saying that the method does not exist.

I am getting the reference to the ComboBox by calling document.getElementById("<% = combo.ClientID %>") but I notice that in your examples you are using a function called $find which appears to be undocumented as I can find no description of it anywhere on the web.

If I try to use this instead of getElementByID it always returns null.

Please could you explain to me the difference between $find and getElementById and how I can get this to work.

I have tried enclosing the script in a RadScriptBlock but it made no difference.

I am using version 2008.3.1314.35 of the Rad Ajax Components

Bob Boffin
Veronica
Telerik team
 answered on 26 May 2010
2 answers
118 views
HI Telerik Team,
I am having Rad menu, and on right hand side i am having flash content, you can see here http://www2.gsba.com/Resources/Publications/OtherPublications.aspx 
Rad menu is not displaying fully, it is getting cut by flash and the full menu which is to be displayed you can see it here.http://www2.gsba.com/Resources.aspx
do you people have anything for this.
it is very urgent for me. i have some urgent release and before that i need to fix it.
see screenshot.

Thanks for your time and support.

Vivek

Vivek
Top achievements
Rank 1
 answered on 26 May 2010
3 answers
148 views
Hi,

I'm using custom paging with a RadGrid and passing a StartRow and RowCount parameters to a stored procedure to return only my desired rows. The tables I work with are very big so the whole process needs to be optimized as much as possible.

I would like to use an SqlDataReader because I've read that would offer the greatest speed, however I'm having difficulties getting the TotalRows with an SqlDataReader.

I also can't access an Output Parameter because its value isn't set until the DataReader is closed. Therefore I've added the Total Rows as an additional field on my resultset. However, if I read the first row to get the Total Rows, the DataReader moves onto the next row and it isn't displayed in the Grid. 

I can get it working nicely by using an SqlDataAdapter to populate a DataTable and passing that to the grid, I just wanted to know if there was any way to get the RowCount by using the SqlDataReader and Paging.

Wyatt
Top achievements
Rank 1
 answered on 26 May 2010
2 answers
94 views
hi

how change excel export font name.
i want change font to "tahoma" .   tahoma is windows recommended  for Persian language.


Pouya ir
Top achievements
Rank 1
 answered on 26 May 2010
2 answers
190 views
I have to do everything at runtime; tree nodes vary by user. I used example code to apply node templates... works as expected.
When I select a node (and get the postback) the templates are not applied. Then I select a node again (and get the postback), the template is applied... it just toggles back and forth. Code is below....
 
  Private Sub GetAccountProducts(ByVal AccountID As String, ByVal Category As String, ByRef node As Telerik.Web.UI.RadTreeNode)  
        Try 
             
            Dim objCom As New SqlClient.SqlCommand  
            Dim objDA As New SqlClient.SqlDataAdapter  
            Dim objDT As New DataTable  
 
            objCom.Connection = objSLXCon  
            objCom.CommandText = "select ap.ACCOUNTPRODUCTID, ap.SERIALNUMBER, ap.PRODUCTNAME " & _  
                "from accountproduct ap inner join product p on ap.productid = p.productid " & _  
                "where ap.accountid = '" & AccountID & "' and p.family = '" & Category & "' " & _  
                "and ap.accountproductid in (select accountproductid from ADVANTAGEVISIONACCESS where contactid = '" & Request.Cookies("UserID").Value & "')" 
            objDA.SelectCommand = objCom  
            objDA.Fill(objDT)  
 
            For Each dr As DataRow In objDT.Rows  
                Dim AssetNode As New Telerik.Web.UI.RadTreeNode()  
                AssetNode.Text = dr.Item("SERIALNUMBER").ToString  
                AssetNode.Value = dr.Item("ACCOUNTPRODUCTID").ToString  
                AssetNode.Attributes.Add("Level", "Asset")  
                AssetNode.Attributes.Add("Model", dr.Item("PRODUCTNAME"))  
                AssetNode.NavigateUrl = "Assets.aspx?Level=Asset&AssetID=" & dr.Item("ACCOUNTPRODUCTID").ToString  
                Dim template As New AssetTemplate()  
                template.InstantiateIn(AssetNode)  
                node.Nodes.Add(AssetNode)  
            Next 
 
        Catch ex As Exception  
 
        End Try 
    End Sub 
 
Class AccountTemplate  
    Implements ITemplate  
 
    Public Sub InstantiateIn(ByVal container As Control) Implements System.Web.UI.ITemplate.InstantiateIn  
        Dim label1 As New Label()  
        Dim node As RadTreeNode = DirectCast(container, RadTreeNode)  
        label1.ID = "accountnamelabel" 
        label1.Text = node.Text  
        label1.ForeColor = Drawing.Color.Black  
        container.Controls.Add(label1)  
    End Sub 
 
End Class 
 
Class ContactTemplate  
    Implements ITemplate  
 
    Public Sub InstantiateIn(ByVal container As Control) Implements System.Web.UI.ITemplate.InstantiateIn  
        Dim label1 As New Label()  
        Dim node As RadTreeNode = DirectCast(container, RadTreeNode)  
        label1.ID = "alllocationslabel" 
        label1.Text = node.Text  
        label1.ForeColor = Drawing.Color.Black  
        container.Controls.Add(label1)  
    End Sub 
 
End Class 
 
Class FamilyTemplate  
    Implements ITemplate  
 
    Public Sub InstantiateIn(ByVal container As Control) Implements System.Web.UI.ITemplate.InstantiateIn  
        Dim label1 As New Label()  
        Dim node As RadTreeNode = DirectCast(container, RadTreeNode)  
        label1.ID = "familynamelabel" 
        label1.Text = node.Text  
        label1.ForeColor = Drawing.Color.Black  
        container.Controls.Add(label1)  
    End Sub 
 
End Class 
 
Class AssetTemplate  
    Implements ITemplate  
 
    Public Sub InstantiateIn(ByVal container As Control) Implements System.Web.UI.ITemplate.InstantiateIn  
        Dim label1 As New Label()  
        Dim label2 As New Label()  
 
 
        Dim node As RadTreeNode = DirectCast(container, RadTreeNode)  
        label1.ID = "assetnamelabel" 
        label1.Text = node.Attributes("Model")  
        label1.ForeColor = Drawing.Color.Black  
        container.Controls.Add(label1)  
        label2.ID = "assetseriallabel" 
        label2.Text = " - SN: " & node.Text  
        label2.ForeColor = Drawing.Color.Black  
        container.Controls.Add(label2)  
    End Sub 
 
End Class 
John Crumpton
Top achievements
Rank 1
 answered on 26 May 2010
6 answers
338 views
I have implemented a custom skin (basically a copy of the default with a few minor changes) for my grid.  Everything works except when I group by a column.

When I group by a column I get the column name in the Group Panel but the button next to it to sort it Asc or Desc does not show the correct image.  All I see is a default button with no text about 25px wide.

I can't find anywhere in the stylesheets where these images are called from.  The embedded styles get the correct images.  Is this a bug or can someone point  me to the correct place to reference the image path for these two items.

Thanks
Cartoon Head
Top achievements
Rank 1
 answered on 26 May 2010
11 answers
631 views
I've uninstalled the controls with both the uninstaller that came with the tool as well as Windows Install Cleanup. Also uninstalled the telerik.* references from the WIndows\Assembly. Yet the Telerik menu still displays in VS 2008 without any functional links.

How do I get rid of this thing? Thanks

Roger 
Ken Palmer
Top achievements
Rank 1
 answered on 26 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?