Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
177 views
I am trying to fetch the primary key field values for grid items using the example on this page:  http://www.telerik.com/help/aspnet/grid/grdretrieveprimarykeyfieldvaluesforitems.html  Here is the aspx and code-behind:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="test_Default" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<%@ Register assembly="DevExpress.Data.v8.2.Linq, Version=8.2.4.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1" namespace="DevExpress.Data.Linq" tagprefix="dxdtlnq" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Vendor</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:LinqDataSource ID="LinqDataSource1" runat="server"
            ContextTypeName="AWDataContext" TableName="vVendors">
        </asp:LinqDataSource>
        <telerik:RadGrid ID="RadGrid1" runat="server"
            DataSourceID="LinqDataSource1" GridLines="None"
            onitemcommand="RadGrid1_ItemCommand">
<MasterTableView datasourceid="LinqDataSource1" autogeneratecolumns="False">
<Columns>
    <telerik:GridButtonColumn CommandName="Select" UniqueName="Select" Text="Select" DataTextField="VendorId">
    </telerik:GridButtonColumn>

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class test_Default : System.Web.UI.Page
{
    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "Select")
        {
           //the next line throws the error
            Response.Write("Primary key for the clicked item from ItemCommand: " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["VendorID"] + "<br>");
        }
    }
}


   
    
    
    <telerik:GridBoundColumn DataField="VendorID" DataType="System.Int32"
        HeaderText="VendorID" SortExpression="VendorID" UniqueName="VendorID">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="Name" HeaderText="Name"
        SortExpression="Name" UniqueName="Name">
    </telerik:GridBoundColumn>

</Columns>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>

<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
</MasterTableView>

            <ClientSettings>
                <Selecting AllowRowSelect="True" />
            </ClientSettings>

<FilterMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
        </telerik:RadGrid>
    
    </div>
    <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
    </telerik:RadScriptManager>
    </form>
</body>
</html>

Each time I click on Select I get the following error after the post back:

"Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index" on the line noted above. 

Why does this happens?  Also what is the recommended way to collect the values of the selected row columns from a RadGrid?  Should I just use a GrtidHyperLinkColumn bound to the VendorId?






Matt
Top achievements
Rank 1
 answered on 20 Oct 2008
1 answer
134 views

Requirements

RadControls version

2008.2.1001.35

 

 



.NET version

3.5

Visual Studio version

2008 SP1

programming language

C#

browser support

all browsers supported by RadControls

I have added a RadGrid and the 
            EnableAJAX="True" 
            EnableAJAXLoadingTemplate="True" 
have been removed from the RadGrid AJAX version 2008.2.1001.35 and I would like to know how I would use the EnableAJAXLoadingTemplate?

I have put the RadScriptManager and the RadAjaxManager on my master page. I have also used the RadAjaxManagerProxy in the control where I have the RadGrid to enable AJAX on the RadGrid. I see the property for EnableAJAX is on the RadAjaxManager I have on my MasterPage.

What do I need to do to get the EnableAJAXLoadingTemplate to work so when a new page is loading in the RadGrid we can get the spinning icon on the RadGrid until the new page is loaded without a full post back?

Thank you,

Daniel

Daniel
Top achievements
Rank 1
 answered on 20 Oct 2008
2 answers
155 views
Using the RadAjax control to load content that contains an iframe causes the iframe's document to be cleared because the content is moved within the DOM.

I've traced the problem down to Telerik.Web.UI.RadAjaxControl.InsertAtLocation, which calls insertBefore. The fact that insertBefore clears the iframe document is a problem with Firefox. My problem is figuring out why InsertAtLocation is called by the endRequest handler. It is looping through "panelsToClear[]". I would expect the response from the ajax request to be inserted at its target location without having to move it.

Unfortunately, I have not been able to create a simple application that shows the problem. It only happens in the more complex application.

Any insight on how to prevent InsertAtLocation from moving the content with the iframe is greatly appreciated. In fact, as I think of it, I might be able to initialize the iframe AFTER the radajax endRequest has finished moving it. Can I attach an event handler to that event from within the ajax response script?

Firefox 2.0.0.15
Doug Domeny
Top achievements
Rank 1
 answered on 20 Oct 2008
2 answers
182 views

Here is the problem:
when I refresh my page the radsplider render at the last control in the page.
when I change the value using ajax manager to make autopostback and right the value in the label as demostrated in this example (the first example)
http://demos.telerik.com/aspnet/prometheus/Slider/Examples/ServerSideEvents/DefaultCS.aspx 
it delays to make a postback and write the value in the label. if  i slide again and again I will get this error:

Error: [Exception... "'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "<unknown>"  data: no]

I have created a sample project and it does work with out any problem but when I take it to the main project it does not work I have updated every thing the same as my sample project.
here the slider code in my code:

<

 

asp:Label ID="labelslider" runat="server"></asp:Label>% Complete:<span

 

 

class="required">*</span> </td><td class="dataOne" colspan="4">

 

 

<telerik:RadSlider ID="RadSlider1" runat="server" AutoPostBack="true" OnValueChanged="RadSlider1_ValueChanged" Skin="WebBlue" />

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

<AjaxSettings>

 

 

<telerik:AjaxSetting AjaxControlID="RadSlider1">

 

 

<UpdatedControls>

 

 

<telerik:AjaxUpdatedControl ControlID="RadSlider1" />

 

 

<telerik:AjaxUpdatedControl ControlID="labelslider" />

 

 

</UpdatedControls>

 

 

</telerik:AjaxSetting>

 

 

</AjaxSettings>

 

 

</telerik:RadAjaxManager>

 

protected

 

void RadSlider1_ValueChanged(object sender, EventArgs e)

 

{

labelslider.Text = RadSlider1.Value.ToString();

}

Tsvetie
Telerik team
 answered on 20 Oct 2008
2 answers
179 views
I downloaded the Telerik ObjectContainerDataSource sample and while that works, my implementation of it doesn't, completely.

I can get the page to load and data to load into the grid, but when I try to edit or insert a new record, the entire grid collapses to a single line.

I've scoured my code to the Telerik code and they seem to be similar, except mine is pointing to my data objects.

So I've finally realized I need to consult the Forums.

Does anyone know why the grid is collapsing when I try to insert or edit a record?

If it helps, I'm also using Unity, the Dependency Injection component from Microsoft.

Thanks,

King Wilder
King Wilder
Top achievements
Rank 2
 answered on 20 Oct 2008
4 answers
255 views
In the 2008 Q2 (and now in the Q3 as well) versions of the suite, I've witnessed some strange behaviour with the TimeView.

Basically I've got a form which opens in a RadWindow containing a RadDateTimePicker and a RadTimePicker on one line in the form.  The TimeView for both pickers is relatively wide and fills the entire width of the RadWindow, so for the RadTimePicker I had used style="margin-left: -300px;" to offset it back enough to be visible.  This worked until Q2.

Now, what I'm witnessing (in IE7), is a disabled scrollbar at the bottom of the TimeView for both of the pickers, which is the width of the TimeView (in this case, 520px).  The left-most part of this scrollbar always lines up with the left-side of the picker's textbox - meaning that the "margin-left: -300px;" does not affect the position of that scrollbar.  In my case, this causes a vertical scrollbar to appear in the RadWindow.  On top of that, though, the rest of the TimeView does get offset by the -300px but the part that is offset is not visible on the page.

Here's a screenshot:

http://www.microagebasics.com/support/temp/timeviewerr.png

Thanks,

Shaun.
Dimo
Telerik team
 answered on 20 Oct 2008
1 answer
245 views
Hi!

I'm trying to calculate the color contrast and brightness difference using JavaScript.

I was wondering how I can get the R, G, B values respectively? I know in c# codebehind, I can retrieve R, G, B values by:
RadColorPicker1.SelectedColor.R
RadColorPicker1.SelectedColor.G
RadColorPicker1.SelectedColor.B

Thanks for all your help.
Tsvetie
Telerik team
 answered on 20 Oct 2008
1 answer
133 views
hello,

i have a RadComboBox that uses multiple columns:

<Telerik:RadComboBox ID="rcbSignals" DataValueField="SignalTypeID" DataTextField="Code" Width="230" DropDownWidth="400" ShowToggleImage="true" Filter="Contains" AllowCustomText="True" MarkFirstMatch="true" HighlightTemplatedItems="true" skin="Gray" OnClientFocus="showDropDown" runat="server"
    <ItemTemplate> 
        <%# DataBinder.Eval(Container.DataItem, "Code")%> - <%# DataBinder.Eval(Container.DataItem, "Description")%> 
    </ItemTemplate> 
</Telerik:RadComboBox> 

...question -- after a user makes a selection, how do i show both its columns in the text input area? currently only the column designated in the DataTextField property is showing up.


thanks,
matt
matt
Top achievements
Rank 1
 answered on 20 Oct 2008
1 answer
229 views
I am using a radtreeview using code behind to generate the nodes. When the user puts the treeview into 'edit' mode I add a text box to the node using the code below.

The problem occurs when a user clicks on a text box. The text box and node seem to get focus. The user cannot use the mouse to select any text in the text box. This is a major pain if the text box has a lot of text and they need to select a large chunk of text and delete it.

The text box is also ignoring the SelectionOnFocus, no text is not being selected on focus.

Can I get some help for these two problems? Both probably stem from the same behavior.  Maybe Z-order could fix this?

internal

 

class NodeCheckboxTemplate : NodeBaseTemplate, ITemplate

 

{

 

public NodeCheckboxTemplate(NodeBuilderContext context, bool editing) : base(context, editing) { }

 

 

public void InstantiateIn(Control container)

 

{

 

var node = (RadTreeNode)container;

 

 

if (IsEditing)

 

{

 

var factTextBoxControl = new RadTextBox

 

{

ID = container.UniqueID +

"RadTextBox",

 

SkinID =

"treeTextBox",

 

Width =

Unit.Pixel(FactGridTemplateBuilder.Width),

 

Text = node.Value,

SelectionOnFocus =

SelectionOnFocus.SelectAll,

 

EnableViewState =

false

 

};

factTextBoxControl.Text = node.Value;

node.Controls.Add(factTextBoxControl);

 

}

 

 

else

 

{

CreateValueLabel(container, node.Value);

}

}

}

Veselin Vasilev
Telerik team
 answered on 20 Oct 2008
3 answers
401 views
Hi,

Please show an example for a Radtoolbar dropdown button, which has checkboxes along with its text, So that when i drill the dropdown button i should be able to select one or more checkbox(s) and get a server/client side event with list of selected checkboxe(s).

Thanks in advance.
Peter
Telerik team
 answered on 20 Oct 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?