Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
227 views
I need to add GridHeaderItem just like the way it is done in this link with the GridView
http://csharpdotnetfreak.blogspot.com/2008/11/merging-gridview-headers-to-have.html

Here's the part of the code from the link:
protected void grvMergeHeader_RowCreated
(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
    GridView HeaderGrid = (GridView)sender;
    GridViewRow HeaderGridRow =
    new GridViewRow(0, 0, DataControlRowType.Header,
    DataControlRowState.Insert);
    TableCell HeaderCell = new TableCell();
    HeaderCell.Text = "Department";
    HeaderCell.ColumnSpan = 2;
    HeaderGridRow.Cells.Add(HeaderCell);

    HeaderCell = new TableCell();
    HeaderCell.Text = "Employee";
    HeaderCell.ColumnSpan = 2;
    HeaderGridRow.Cells.Add(HeaderCell);

    grvMergeHeader.Controls[0].Controls.AddAt
    (0, HeaderGridRow);

}
}

I tried on my own up to this point but with no sucess. MyRadGrid is the name of the RadGrid.

 

 

protected

void RollUpDataRadGrid_ItemCreated(object sender, GridItemEventArgs e)

 

{

 

if (e.Item is GridHeaderItem)

 

{

 

RadGrid HeaderGrid = (RadGrid)sender;

 

 

GridHeaderItem headerItem = new GridHeaderItem(MyRadGrid.MasterTableView, 0, 0);

 

 

TableCell headerCell = new TableCell();

 

headerCell.Text =

"Department";

 

headerCell.ColumnSpan = 2;

headerItem.Cells.Add(headerCell);

headerCell =

new TableCell();

 

headerCell.Text =

"Employee";

 

headerCell.ColumnSpan = 2;

headerItem.Cells.Add(headerCell);

MyRadGrid.Controls[0].Controls.AddAt(0, headerItem);

}

}

 

 

 

 

I will appreciate if anyone has some inputs to it.

Thanks,
Raju
Tsvetoslav
Telerik team
 answered on 01 Oct 2012
6 answers
470 views
I have a fixed position div that is always at the bottom of my page.  Inside that is a RadComboBox with around 30 items.  Sometimes it expands upwards, sometimes it expands downwards and so out of view and unusable. 

How can I force the RadComboBox to always expand upwards?

Thanks.
Vivek
Top achievements
Rank 1
 answered on 01 Oct 2012
1 answer
55 views
Hi,
I need create chart with possibiliti to display pictures below x-axis line in 2 (or more) rows. In sample picture you can see 2 rows 'act' and 'fcst'. The pictures should be displayed for each hour depends on data .
Is it possible in RadChart (or any different Telerik charts?)
Regards.
Leszek
Vladimir Milev
Telerik team
 answered on 01 Oct 2012
4 answers
457 views
I am Fresher and also very new to telerik,so
Is their any good site or tutorial to learn telerik control self from basic
Thank U
Kate
Telerik team
 answered on 01 Oct 2012
1 answer
97 views
I am following the post to do Automatic CRUD operation on rad grid using Entity Framework by using:
http://demos.telerik.com/aspnet-ajax/grid/examples/automaticoperations/efdatabinding/defaultvb.aspx

My code for Design Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Demo.aspx.cs" Inherits="Telerik.Demo" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <style type="text/css">
        .MyImageButton
        {
            cursor: hand;
        }
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            color: #0066cc;
        }
    </style>
</head>
<body class="BODY" style="background-color: Black">
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EntityDataSource1" GridLines="None"
            AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
            AllowAutomaticDeletes="True" AllowSorting="True" Width="750px" OnItemCreated="RadGrid1_ItemCreated"
            CellSpacing="0" Skin="Black">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <ClientSettings>
                <Selecting CellSelectionMode="None"></Selecting>
            </ClientSettings>
            <MasterTableView DataSourceID="EntityDataSource1" AutoGenerateColumns="False" DataKeyNames="ID"
                CommandItemDisplay="Top">
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID"
                         MaxLength="5">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
                        UniqueName="Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Address" HeaderText="Address" SortExpression="Address"
                        UniqueName="Address">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="DeptID" HeaderText="DeptID" SortExpression="DeptID"
                        UniqueName="DeptID">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                </Columns>
                <EditFormSettings>
                    <EditColumn ButtonType="ImageButton" />
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=Entity"
            DefaultContainerName="Entity" EnableDelete="True" EnableFlattening="False" EnableInsert="True"
            EnableUpdate="True" EntitySetName="EMPLOYEEs" EntityTypeFilter="EMPLOYEE">
        </asp:EntityDataSource>
    </div>
    </form>
</body>
</html>

Code Behind Page:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;


namespace Telerik
{
    public partial class Demo : System.Web.UI.Page
    {
        Entity ent = new Entity();
        EMPLOYEE emp = new EMPLOYEE();
        protected void Page_Load(object sender, EventArgs e)
        {  
                RadGrid1.DataSourceID = null;
                BindGrid();
        }

        public void BindGrid()
        {
                var query5 = from employee in ent.EMPLOYEEs
                             select new
                             {
                                 ID = employee.ID,
                                 NAME = employee.NAME,
                                 ADDRESS = employee.ADDRESS,
                                 DEPTID = employee.DEPTID
                             };
                RadGrid1.DataSource = query5;
        }

        protected void RadGrid1_ItemCreated(object sender, Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                if (!(e.Item is GridEditFormInsertItem))
                {
                    GridEditableItem item = e.Item as GridEditableItem;
                    GridEditManager manager = item.EditManager;
                    GridTextBoxColumnEditor editor = manager.GetColumnEditor("ID") as GridTextBoxColumnEditor;
                    editor.TextBoxControl.Enabled = false;
                }
            }
        }

        protected void gv1_NeedDataSource(object sender, Web.UI.GridNeedDataSourceEventArgs e)
        {
            BindGrid();
        }
    }
}

while execution it does nothing,only grid is displayed without any of the CRUD operation
Plz Help,
Thanks
Andrey
Telerik team
 answered on 01 Oct 2012
2 answers
91 views
I have a radgrid that when the page loads all items are in edit mode. When I click to go to the next page all of the items on the next page aren't in edit mode. :( I gave to click "edit" for each item. I'd like for the next page to go into edit mode too.

This is what I'm using to get it into edit mode, which works for the first page.

protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        LinkButton lnkBtnDelete = (LinkButton)item["AutoGeneratedDeleteColumn"].Controls[0];
        lnkBtnDelete.Attributes["onclick"] = "javascript:return confirm(\'Do you want to delete this item?\')";
    }
    if (!Page.IsPostBack && e.Item is GridEditableItem)
    {
        e.Item.Edit = true;
    }
 
}

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        foreach (GridItem item in RadGrid1.MasterTableView.Items)
        {
            if (item is GridEditableItem)
            {
                GridEditableItem editableItem = item as GridDataItem;
                editableItem.Edit = true;
            }
        }
        RadGrid1.Rebind();
    }
}



Kee Fai Foong
Top achievements
Rank 1
 answered on 30 Sep 2012
1 answer
128 views
Hi,

I have a grid with a lot of data.  I notice that when I add a new row it load the grid and presents the editable section at the very end of the grid pagination.  This increases the amount of time required to add a record.  Whenever we are adding a record we are doing so on the first page so it is most desirable to have the insert happen in the 1st position instead of having to reload the grid and go to the end.  Hope that make sense and how can I accomplish this.

Thanks

Eric
Jayesh Goyani
Top achievements
Rank 2
 answered on 30 Sep 2012
5 answers
188 views
Just starting to use telerik controls and I've combed through the forums and documentation for my problem but something hasn't clicked for me.  My scenario is that I have a radgrid with multiple griddropdowncolumns, 7 of them to be exact (days of the week).  The data is being bound in codebehind of type int for these 7 columns (there are other columns but those are coming back fine).  When I'm binding the data to the grid, the griddropdowncolumns do not populate at all.  The values should be between 1-5 to represent a status for each day.  So, initially, upon load of the radgrid, the columns will appear with respective status' and in edit mode the user shoul be able to select a different status for each day.  Sorry for the length, but trying to make my point here...
Here is a snippet of  my aspx code:
<telerik:GridDropDownColumn DataField="Mon" HeaderText="Mon" ListTextField=""
                                ListValueField="Mon" UniqueName="MonTitleColumn" DropDownControlType="RadComboBox" ColumnEditorID="MonTitleEditor1" />
                            <telerik:GridDropDownColumn DataField="Tue" HeaderText="Tue" ListTextField="StatusName"
                                ListValueField="Tue" UniqueName="TueTitleColumn" DropDownControlType="RadComboBox" ColumnEditorID="FebTitleEditor1" />
                            <telerik:GridDropDownColumn DataField="Wed" HeaderText="Wed" ListTextField="StatusName"
                                ListValueField="Wed" UniqueName="MarTitleColumn" DropDownControlType="DropDownList" ColumnEditorID="MarTitleEditor1" />
                            <telerik:GridDropDownColumn DataField="Thu" HeaderText="Thu" ListTextField="StatusName"
                                ListValueField="Thu" UniqueName="ThuTitleColumn" DropDownControlType="DropDownList" ColumnEditorID="AprTitleEditor1" />
                            <telerik:GridDropDownColumn DataField="Fri" HeaderText="Fri" ListTextField="StatusName"
                                ListValueField="Fri" UniqueName="MayTitleColumn" DropDownControlType="DropDownList" ColumnEditorID="MayTitleEditor1" />
How do I show the value in the db (1-5) for each of the GridDropDownColumns and in edit mode select the values 1-5...
I'm afraid I've spent all day and yesterday and my brain is fried.  And in the process I've thoroughly confused myself.
Any and all help is appreciated!
SS
SikhSuperman
Top achievements
Rank 1
 answered on 30 Sep 2012
1 answer
95 views
Hi!

Here is my problem:
I use ascx editform in telerik radgrid. I have some textboxes, a Cancel and a Save button on it.
I want it to work the following way:
- if the user writes correct values in the textboxes and clicks the save button, the editform must close and the grid must show the new values.
- if the user writes wrong values in the textboxes and clicks the button, the editform must stay visible so the user can change the wrong values.

The situation is a little bit more complicated, because I use the editform in the grid's childgrid/detailtable.
If it is possible, I want to solve the problem in the ascx form's code behind. 

Sorry for my bad English,
Thanks for the answers!
Kostadin
Telerik team
 answered on 29 Sep 2012
1 answer
66 views
Hi,

I have a data structure similar to the one below where one class contains a colleciton of another class as one of it's fields:

Product
{
    String name
    String desription
    Address[] addresses
}

Address
{
    String state
    String suburb
}

Within a data grid which I am binding to the Product class, I want to display only the Product "name" field but have it grouped by the "state" field of the first item of the addresses collection (within my data I am ensuring that every Product has at least one Address)

So my data grid would look somthing like:

VIC
    - Product Name 1
    - Product name 2
NSW
    - Product Name 3
    - Product Name 4

Is this possible? To date I can only get grouping working on fields within the Business (or top level) class, not fields from the Address (or nested) class.
Angel Petrov
Telerik team
 answered on 29 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?