Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
226 views

I have a problem in using RadChart of asp.net ajax 2009.1.402.35 inside asp.net MVC2 projects. The chart works fine if I put the ChartTest1.aspx page directly under the project folder. However, if I put a page "ChartTest2.aspx" in a folder (projectroot/ChartPages/ChartTest2.aspx), error happens (the resouce cannot be found...., and Requested URL:/ChartPages/ChartImage.axd).

I think this is due to page routing issue. To be more specific, the application is a hybric platform of Webfrom and Webview. However, I know it is compatible. The issue is how to set the corretc rounting. I have tried a trick in another post by putting code "

 

RadChart1.HttpHandlerUrl = ResolveUrl(

 

"ChartImage.axd") behind. can someone help me resolve the problem?

Ves
Telerik team
 answered on 21 Jul 2010
3 answers
203 views
I have a webpage that creates a datatable programmatically depending on options that users have chosen on different pages.  I store the table as a session variable, then when the time comes, I assign the table to the grid during NeedDataSource.  No columns are explicitly defined in the RadGrid.  One of the columns could contain a percentage value.

The problem comes when someone tries to sort this percentage column:  It seems to sort as text!  100% will show up next to 10% and be listed lower than 95%.  I read through the forums and the only remedy I found was to define the radgrid column as a percentage value.  Unfortunately, I have not explicitly defined the columns in the radgrid, so RadGrid1.MasterTableView.Columns.Count = 0 and I cannot set column X's property to percentage.

Any suggestions for how to fix my sorting problem?

Iana Tsolova
Telerik team
 answered on 21 Jul 2010
1 answer
96 views
Is it possible to wrap the filter so that adding expressions render them in a table format (e.g. a 3x3 table ) instead of one dimension top to bottom?
Nikolay Rusev
Telerik team
 answered on 21 Jul 2010
1 answer
104 views
Please see attached snap. how can we add pagin like and one can jump to the specified page
Shinu
Top achievements
Rank 2
 answered on 21 Jul 2010
1 answer
100 views
hi,

I have one question about RadScheduler.    how can i get the value of one field of the appointment from code behind instead of using SqlDataSource ?

in my case, i wanna apply different colors to different types of appointments. i have colorID and colorCode(FFFFFF) in the database. how do i set the value of colorID or colorCode to different appointments from code behind?

Thanks !
Yana
Telerik team
 answered on 21 Jul 2010
5 answers
263 views

I have a RadTabStrip that just refuses to show up when page loads or reposts. Not certain what I would need to do to get this working at this point. No where in my code do I disable the control for it not to show up when loaded.

<telerik:RadTabStrip ID="RadTabStrip1" AutoPostBack="true" runat="server" OnClientTabSelecting="TabSelecting"/> 

The Tabcollection is filled on postback, so I am not certain why this is happening. Even explicitly setting the enable property to true both on the client and the server side does not seem to work. Any idea what the problem might be?

Thanks in advance!

 

Kamen Bundev
Telerik team
 answered on 21 Jul 2010
2 answers
208 views
Hi,

I am trying to update a record using RADGrid, but the RadGrid1_UpdateCommand event is not firing, I am using in-place edit mode
On click of the edit icon the row gets converted into edit mode and RadGrid1_EditCommand event is fired, but after chaging the values the breakpoint never executes the RadGrid1_UpdateCommand event.

My code is below:

 

 

 

 

<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" PageSize="10" AllowPaging="True" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource" AutoGenerateColumns="False" AllowAutomaticUpdates="True" OnItemUpdated="RadGrid1_ItemUpdated"OnUpdateCommand="RadGrid1_UpdateCommand" OnEditCommand="RadGrid1_EditCommand"OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound" OnDeleteCommand="RadGrid1_DeleteCommand" onitemcommand="RadGrid1_ItemCommand" >

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

<MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="slno"

HorizontalAlign="NotSet" AutoGenerateColumns="False" EditMode="InPlace" >

 

<Columns>

 

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">

 

<ItemStyle CssClass="MyImageButton" />

 

</telerik:GridEditCommandColumn>

 

<telerik:GridBoundColumn DataField="slno" HeaderText="Id" SortExpression="slno"

UniqueName="slno">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn DataField="cData" HeaderText="Data" SortExpression="cData" UniqueName="cData" ColumnEditorID="GridTextBoxColumnEditor1">

 

</telerik:GridBoundColumn>

 

<telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">

 

<ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />

</telerik:GridButtonColumn>

 

</Columns>

 

<EditFormSettings ColumnNumber="1" CaptionDataField="LoginName" CaptionFormatString="Edit details of Customer {0}">

 

<FormTableItemStyle Wrap="False"></FormTableItemStyle>

 

<FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>

 

<FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" />

 

<FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />

 

<FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>

 

<EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record" UniqueName="EditCommandColumn1" CancelText="Cancel edit">

 

</EditColumn>

 

<FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>

 

</EditFormSettings>

 

</MasterTableView>

 

<ClientSettings>

<ClientEvents OnRowDblClick="RowDblClick" />

</ClientSettings>

 

</telerik:RadGrid>

 

<telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="40px" />

 

<telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>

 

 

 

DataSet ds;

    SqlDataAdapter da;

    SqlConnection conn;

 

    string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();

 

    protected void Page_Load(object sender, EventArgs e)

    {

        //if (Page.IsPostBack == false)

        //{

        //fillData();

        //}

        //RadGrid1.UpdateCommand += new GridCommandEventHandler(RadGrid1_UpdateCommand);

    }

 

    protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

    {

        fillData();

    }

 

    protected void fillData()

    {

        conn = new SqlConnection(connStr);

        ds = new DataSet();

        da = new SqlDataAdapter("select * from tblData", conn);

        da.Fill(ds, "customerMast");

 

        ds.Tables[0].PrimaryKey = new DataColumn[] {ds.Tables[0].Columns["slno"]};

 

        //RadGrid1.MasterTableView.DataSource = ds.Tables[0];

        RadGrid1.DataSource = ds.Tables[0];

    }

 

    protected void RadGrid1_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)

    {

        GridEditableItem item = (GridEditableItem)e.Item;

        String id = item.GetDataKeyValue("CustId").ToString();

 

        if (e.Exception != null)

        {

            e.KeepInEditMode = true;

            e.ExceptionHandled = true;

            SetMessage("Customer with ID " + id + " cannot be updated. Reason: " + e.Exception.Message);

        }

        else

        {

            SetMessage("Customer with ID " + id + " is updated!");

        }

 

    }

 

    protected void RadGrid1_ItemInserted(object source, GridInsertedEventArgs e)

    {

        if (e.Exception != null)

        {

            e.ExceptionHandled = true;

            SetMessage("Customer cannot be inserted. Reason: " + e.Exception.Message);

        }

        else

        {

            SetMessage("New Customer is inserted!");

        }

    }

 

    protected void RadGrid1_ItemDeleted(object source, GridDeletedEventArgs e)

    {

        GridDataItem dataItem = (GridDataItem)e.Item;

        String id = dataItem.GetDataKeyValue("slno").ToString();

 

        if (e.Exception != null)

        {

            e.ExceptionHandled = true;

            SetMessage("Customer with ID " + id + " cannot be deleted. Reason: " + e.Exception.Message);

        }

        else

        {

            SetMessage("Customer with ID " + id + " is deleted!");

        }

    }

    private void DisplayMessage(string text)

    {

        RadGrid1.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));

    }

 

    private void SetMessage(string message)

    {

        gridMessage = message;

    }

 

    private string gridMessage = null;

    protected void RadGrid1_DataBound(object sender, EventArgs e)

    {

        if (!string.IsNullOrEmpty(gridMessage))

        {

            DisplayMessage(gridMessage);

        }

    }

 

    protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)

    {

        //Occurs when the Update button is clicked for an item in the Telerik RadGrid control.

 

        GridDataItem dataItem = (GridDataItem)e.Item;

        String id = dataItem.GetDataKeyValue("ProductID").ToString();

        DisplayMessage("update " + id);

    }

 

    protected void RadGrid1_EditCommand(object source, GridCommandEventArgs e)

    {

        //Occurs when the Edit button is clicked for an item in the Telerik RadGrid control.

 

        GridDataItem dataItem = (GridDataItem)e.Item;

        String id = dataItem["slno"].Text;

        //String id = dataItem.GetDataKeyValue("ProductID").ToString();

        DisplayMessage("want to update " + id);

    }

 

    protected void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)

    {

        GridDataItem dataItem = (GridDataItem)e.Item;

        String id = dataItem["slno"].Text;

        String idName = dataItem["cData"].Text;

        //String id = dataItem.GetDataKeyValue("ProductID").ToString();

       

        clsMethods objCls = new clsMethods();

        objCls.executeDBQuery("delete from tblData where slno = " + id);

 

        DisplayMessage("Deleted " + idName);

 

        fillData();

 

    }

 

    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)

    {

        if (e.CommandName == "Update")

        {

            GridDataItem dataItem = (GridDataItem)e.Item;

            String id = dataItem["slno"].Text;

            DisplayMessage("update " + id);

        }

 

    }

Ajay
Top achievements
Rank 1
 answered on 21 Jul 2010
3 answers
169 views
How do I add a context menu onto the space of the grid after the rows (as attached)? Thanks.
jing
Top achievements
Rank 1
 answered on 21 Jul 2010
2 answers
169 views

HI,

I get an error when I try to apply a filter on the value of a combobox. I have placed the combobox in a telerik:GridTemplateColumn.
When I filter on any other column it works as expected.

Here is the code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Stedkoder.aspx.cs" Inherits="Stedkoder._Default" MasterPageFile="~/Stedkoder.Master" Debug="true" %>
 
<asp:Content ID="Content2" ContentPlaceHolderID="CPL_Addon" Runat="Server">
    <asp:SqlDataSource ID="DS_Stedkoder" runat="server"
        ConnectionString="<%$ ConnectionStrings:um_edw_addonConnectionString %>"
        DeleteCommand="DELETE FROM [organisationsstruktur].[Sted_Dim_Staging] WHERE [StedKode] = @StedKode"
        InsertCommand="INSERT INTO [organisationsstruktur].[Sted_Dim_Staging] ([StedKode], [Sted], [StedNiveau1]) VALUES (@StedKode, @Sted, @StedNiveau1)"
        SelectCommand="SELECT           StedKode, Sted, StedNiveau1, StedNiveau2
                       FROM             [organisationsstruktur].[Sted_Dim_Staging] a
                       LEFT OUTER JOIN  [organisationsstruktur].[Sted_Niveau1_dim_Staging] b
                            ON (a.[StedNiveau1] = b.StedNiveau1Kode)
                        ORDER BY [StedKode]"
        UpdateCommand="UPDATE [organisationsstruktur].[Sted_Dim_Staging] SET [Sted] = @Sted, [StedNiveau1] = @StedNiveau1 WHERE [StedKode] = @StedKode">
        <DeleteParameters>
            <asp:Parameter Name="StedKode" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Sted" Type="String" />
            <asp:Parameter Name="StedNiveau1" Type="String" />
            <asp:Parameter Name="StedKode" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Sted" Type="String" />
            <asp:Parameter Name="StedNiveau1" Type="String" />
            <asp:Parameter Name="StedKode" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
 
    <asp:SqlDataSource ID="DS_Niveau1" runat="server"
        ConnectionString="<%$ ConnectionStrings:um_edw_addonConnectionString %>"
        SelectCommand="SELECT [StedNiveau1Kode] FROM [organisationsstruktur].[Sted_Niveau1_dim_Staging]">
    </asp:SqlDataSource>
     
    <telerik:radgrid    ID="Grid_Stedkode" runat="server" AllowSorting="True" AutoGenerateColumns="False" AutoGenerateDeleteColumn="False"
                        AutoGenerateEditColumn="False" DataSourceID="DS_Stedkoder" GridLines="Vertical" AllowAutomaticDeletes="True"
                        Font-Names="Verdana" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" ForeColor="#333333"
                        AllowCustomPaging="True" Skin="Office2007" AllowFilteringByColumn="True">
     
        <GroupingSettings CaseSensitive="false" /> 
 
        <MasterTableView DataSourceID="DS_Stedkoder" datakeynames="StedKode">
 
            <RowIndicatorColumn>
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
 
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
         
            <Columns>
                <telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton"
                    InsertImageUrl="Images/Edit.gif" >
                    <HeaderStyle Width="30px"></HeaderStyle>
                </telerik:GridEditCommandColumn>
 
                <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton"
                    ImageUrl="Images/Delete.gif" CommandName="Delete" >
                    <HeaderStyle Width="30px"></HeaderStyle>
                </telerik:GridButtonColumn>
 
                <telerik:GridBoundColumn DataField="StedKode" DataType="System.Int32" HeaderText="StedKode" ReadOnly="True"
                    SortExpression="StedKode"  UniqueName="StedKode" AutoPostBackOnFilter="true" CurrentFilterFunction="EqualTo" >
                </telerik:GridBoundColumn>
 
                <telerik:GridBoundColumn DataField="Sted" HeaderText="Sted" SortExpression="Sted" UniqueName="Sted" 
                    AutoPostBackOnFilter="true" FilterControlWidth="200px" CurrentFilterFunction="Contains">
                </telerik:GridBoundColumn>
 
                <telerik:GridTemplateColumn HeaderText="Niveau 1" AutoPostBackOnFilter="true" FilterControlWidth="200px"
                    CurrentFilterFunction="Contains">
                     
                    <ItemTemplate>
                        <asp:Label ID="Niveau1" runat="server" text='<%# Eval("StedNiveau1") %>' />
                    </ItemTemplate>
                     
                    <EditItemTemplate>
                        <telerik:RadComboBox ID="StedNiveau1Combo" AppendDataBoundItems="true" runat="server" DataSourceID="DS_Niveau1"
                            Width="300px" DataTextField="StedNiveau1Kode" DataValueField="StedNiveau1Kode"
                            Text="Niveau 1" SelectedValue='<%# Bind("StedNiveau1")%>' >
                        </telerik:RadComboBox>
                    </EditItemTemplate>
                </telerik:GridTemplateColumn>
                     
                <telerik:GridBoundColumn DataField="StedNiveau2" HeaderText="Niveau 2" SortExpression="StedNiveau2" ReadOnly="true"
                    UniqueName="StedNiveau2" AutoPostBackOnFilter="true" FilterControlWidth="200px" CurrentFilterFunction="Contains">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:radgrid>
</asp:Content>

And the Error message:

Server Error in '/' Application.
--------------------------------------------------------------------------------

is neither a DataColumn nor a DataRelation for table DefaultView.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: is neither a DataColumn nor a DataRelation for table DefaultView.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[ArgumentException:  is neither a DataColumn nor a DataRelation for table DefaultView.]
   System.Data.DataRowView.get_Item(String property) +1744826
   lambda_method(ExecutionScope , DataRowView ) +65
   System.Linq.WhereEnumerableIterator`1.MoveNext() +161
   Telerik.Web.UI.GridDataTableFromEnumerable.FillDataTableFromEnumerable(IQueryable enumerable) +176
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData35() +4028
   Telerik.Web.UI.GridDataTableFromEnumerable.FillData() +608
   Telerik.Web.UI.GridResolveEnumerable.Initialize() +32
   Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized() +20
   Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, DataView dataView, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +158
   Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +76
   Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource(GridTableView owner, Object dataSource, String dataMember, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields) +383
   Telerik.Web.UI.GridTableView.get_ResolvedDataSource() +140
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +309
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +498
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   Telerik.Web.UI.GridTableView.PerformSelect() +4
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.GridTableView.DataBind() +221
   Telerik.Web.UI.GridTableView.Rebind() +48
   Telerik.Web.UI.GridFilterCommandEventArgs.ExecuteCommand(Object source) +517
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +134
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +38
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +115
   Telerik.Web.UI.GridItem.FireCommandEvent(String commandName, Object commandArgument) +46
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +6151
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4205 

What do I do to fix this error?

Best regards

Erik Hansen

Erik Hansen
Top achievements
Rank 1
 answered on 21 Jul 2010
4 answers
239 views
Is there a way that I can get a Node's FullPath from on the client side?

Here is what I am trying to do if you see an easy way to accomplish this task.

I am using a XmlDataSource to bind a xml file to a RadTreeView.  I use some RadTreeNodeBinding's to get the tree to display properly.  I then added some custom attributes to each node....life is good.

Now I want to Edit/Insert/Delete my nodes and persist those changes back to the file (or eventually the database).

My think was to allow the user to edit some of my custom attributes on the client side then call a function that takes a collection of the attributes and a XPath to where the node in question lives.  This function would then have enough information to handle the saving.

To make this work I need to determine the FullPath on the client side or create a recursive Javascript function to create the path based on the node's parents.

Any ideas?
 
Sky
Top achievements
Rank 1
 answered on 20 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?