Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
274 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
216 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
179 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
188 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
251 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
1 answer
385 views
Hi,

I am trying to export the contents of a RadGrid to PDF but one of the rows has a cell with a long text. When I export it to PDF that cell spans across multiple columns. I tried to set the wrap mode to true but it still didn't work. See code snippet below:

 

private void ConfigurePDFExport()

 

{

 

this.RadGridStaff.ExportSettings.OpenInNewWindow = true;

 

 

this.RadGridStaff.ExportSettings.ExportOnlyData = true;

 

 

this.RadGridStaff.ExportSettings.IgnorePaging = true;

 

 

this.RadGridStaff.ExportSettings.Pdf.PageTitle = "Staff Test";

 

 

this.RadGridStaff.ExportSettings.Pdf.PageHeight = Unit.Parse("210mm", CultureInfo.InvariantCulture);

 

 

this.RadGridStaff.ExportSettings.Pdf.PageWidth = Unit.Parse("297mm", CultureInfo.InvariantCulture);

 

 

this.RadGridStaff.MasterTableView.Columns.FindByUniqueName("EditCommandColumn").Visible = false;

 

 

this.RadGridStaff.MasterTableView.Columns.FindByUniqueName("IssueColumn").Visible = false;

 

 

this.RadGridStaff.ExportSettings.FileName = "Staff";

 

RadGridStaff.MasterTableView.GetColumn(

"LastName").ItemStyle.Wrap = true;
}

If anyone knows how to fix this problem, please let me know.

Thanks,

Marlon.

 

Daniel
Telerik team
 answered on 20 Jul 2010
1 answer
68 views
How to assign  GridButtonColumn header text assign at running time ?

MasterTableView.Columns[2].HeaderText="My header text" won't work for GridButtonColumn -ButtonType="LinkButton", only works for GridBondColumn.

Thanks!

 

Daniel
Telerik team
 answered on 20 Jul 2010
2 answers
211 views
Hi,
I would like to Import excel data into the RadGrid.
1. Export the grid into Excel file using Telerik export options (grid.MasterTableView.ExportToExcel())
2. User can update the Excel file and import the excel data to into the Grid using (oleDB connection)
3. I am getting error while  reading the data from excel file to data set like (External table is not in the expected format)
           xConnStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + path + ";Extended Properties=\"Excel 8.0;HDR=YES;\"";
           string strCom = " SELECT * FROM [" + sheetName + "$] ";
            DataSet sourceDataSet = new DataSet();
            OleDbConnection conn = new OleDbConnection(xConnStr);
            OleDbDataAdapter adapter = new OleDbDataAdapter();
            adapter.SelectCommand = new OleDbCommand(strCom, conn);
            adapter.Fill(sourceDataSet);
            conn.Close();

4. Any idea let me know ?

How to read the excel file that was created by  grid.MasterTableView.ExportToExcel()?

Thanks,
Sabarish.


Daniel
Telerik team
 answered on 20 Jul 2010
1 answer
156 views
i have a Master page and Content form.
i see this train page
i need a sample for using RadAjaxManagerProxy .
how to use this solution?
Cori
Top achievements
Rank 2
 answered on 20 Jul 2010
1 answer
94 views
here a help of ajax and user control :
http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/usercontrol/defaultcs.aspx

i need a sample with master page (No User Control)
Cori
Top achievements
Rank 2
 answered on 20 Jul 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?