Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
172 views
How do I configure the filter menus so they don't auto postback? I want the user to make all the choices and then trigger the filtering on a button click.

Thanks,

Ken
Microsoft MVP [ASP.NET]
Georgi Krustev
Telerik team
 answered on 21 Jul 2009
1 answer
133 views
Hi,

I'm currently using Q3 2008 Ajax RadGrid in my application. As a requirement I have to remember the selected row in the RadGrid when the user leaves the page and comes back. To achieve this, I'm storing the selected row's datakeyname in the Session and reading back from the session when the user comes back to the page. Once I read back the datakeyname from the session I go through each row in the grid and select the row that matched the datakeyname. This was working fine until I migrated from Classic ASP.NET Radcontrols to 2008 Q3 Ajax version. Now after migration it seem the selection is happening but the item is not highlighted in the UI.

Does anyone has similar problem like the one I'm having and any idea how to solve this issue?

kind regards
prakash

Sebastian
Telerik team
 answered on 21 Jul 2009
1 answer
117 views
I've a treeview with folders containing html templates. What I want is to display all the html templates in the rotator when I hover over a folder. Is it possible to shrink the html content so that the entire content is miniaturized and displayed in a say 250px by 250px window?
Fiko
Telerik team
 answered on 21 Jul 2009
1 answer
142 views
I'm using some user controls in a web app with some custom security designed around different product offerings.  Each product offering is defined as a user control which inherits from a custom <MyUserControl> : UserControlBase : UserControl.  As each user control is loaded I'm calling a recursive method to check the parent tree to find the PanelBarItem and disable it if the user control is disabled.

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Text;  
 
/// <summary>  
/// Summary description for UserControlBase  
/// </summary>  
public class UserControlBase : UserControl  
{  
    public UserControlBase() : base()  
    {  
        Log("UserBase Constructor");  
        base.Load += new EventHandler(UserControlBase_Load);  
    }  
 
    void UserControlBase_Load(object sender, EventArgs e)  
    {  
        Log("UserBase Load");  
        bool renderable = false; // || false;  
        SetParentPanel(Parent, renderable);  
    }  
 
    public void SetParentPanel(Control parent, bool enabled)  
    {  
        string key = "TestEnabled";  
        Log(enabled.ToString());  
 
        if (parent == null)  
            return;  
 
        Log(parent.GetType().ToString());  
 
        if (parent is Telerik.Web.UI.RadPanelItem)  
        {  
            Telerik.Web.UI.RadPanelItem panel = parent as Telerik.Web.UI.RadPanelItem;  
            if (string.IsNullOrEmpty(panel.Attributes[key]))  
                panel.Attributes.Add(key, enabled.ToString());  
 
            if (enabled)  
                panel.Attributes[key] = "true";  
 
            if (Convert.ToBoolean(panel.Attributes[key]))  
            {  
                Log("Enabling");  
                panel.Enabled = true;  
                return;  
            }  
            else 
            {  
                Log("Disabling");  
                panel.Enabled = false;  
                return;  
            }  
        }  
 
        SetParentPanel(parent.Parent, enabled);  
    }  
 
    public static void Log(string log)  
    {  
        const int LOGSIZE = 150;  
        const int KBYTESIZE = 1024;  
        const string FILELOC = @"c:\logfiles\testlog.log";  
        using (System.IO.FileStream fs = new System.IO.FileStream(FILELOC, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite))  
        {  
            System.IO.StreamReader reader = new System.IO.StreamReader(fs);  
            log += "\n" + reader.ReadToEnd();  
            int max = LOGSIZE * KBYTESIZE;  
            byte[] bytes = Encoding.UTF8.GetBytes(log);  
            if (bytes.Length < max)  
            {  
                fs.SetLength(0);  
                fs.Write(bytes, 0, bytes.Length);  
            }  
            else 
            {  
                fs.SetLength(0);  
                fs.Write(bytes, 0, max);  
            }  
            fs.Flush();  
            fs.Close();  
        }  
    }  
}  
 

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" 
    CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %> 
<%@ Register Src="~/WebControl1.ascx" TagName="TestControl" TagPrefix="my" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  
    <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Default2006" Width="100%">  
        <Items> 
            <telerik:RadPanelItem runat="server" Text="Control1">  
                <Items> 
                    <telerik:RadPanelItem> 
                        <ItemTemplate> 
                            <my:TestControl runat="server" ID="TestControl1" /> 
                        </ItemTemplate> 
                    </telerik:RadPanelItem> 
                </Items> 
            </telerik:RadPanelItem> 
        </Items> 
        <CollapseAnimation Duration="100" Type="None" /> 
        <ExpandAnimation Duration="100" Type="None" /> 
    </telerik:RadPanelBar> 
</asp:Content> 
 


So far I haven't gotten this to work as defined in the above sample.  Any ideas on how to traverse up and get the telerik RadPanelItem?
Phil DeVeau
Top achievements
Rank 1
 answered on 21 Jul 2009
2 answers
190 views
Hi,

We are programatically creating a Hierarchy Grid with multiple levels on it.
Inorder to hide the Plus image for the items that don't have sub levels we are actually hiding the plus image in the item databound event by checking a "Count" variable that would be populated on the need datasource and detail table bind events.

Everything works fine except for an issue

Assume there are two items,
    one with a plus image as it has 3 child items 
    another item without plus iomaghe as it doesn't have any child item

When I click the plus image of the first item its displays the 3 items below it.At the same time its adding a plus image on the second item as well.This ideally should not happen as it doen't have any child items.

Please find attached the code snippet

 

public partial class InstrProductControl : Microsoft.Practices.CompositeWeb.Web.UI.UserControl, IInstrProductControlView

 

{

 

private InstrProductControlPresenter _presenter;

 

 

[

CreateNew]

 

 

public InstrProductControlPresenter Presenter

 

{

 

get

 

{

 

return this._presenter;

 

}

 

set

 

{

 

if (value == null)

 

 

throw new ArgumentNullException("value");

 

 

this._presenter = value;

 

 

this._presenter.View = this;

 

}

}

#region

 

VIEW EVENTS

 

 

protected void Page_Init(object sender, System.EventArgs e)

 

{

DefineRadGridProductsStructure();

}

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

if (!this.IsPostBack)

 

{

 

this._presenter.OnViewInitialized();

 

 

int noOfproductLevels = _presenter.GetNoOfProductLevels();

 

 

RadGrid gridProduct = radAjaxPnlProducts.FindControl("radGridProducts") as RadGrid;

 

CreateHierarchyTableTemplates(noOfproductLevels, gridProduct);

 

 

}

 

this._presenter.OnViewLoaded();

 

}

 

#endregion

#region

 

PRODUCT GRID STRUCTURE

 

 

private void DefineRadGridProductsStructure()

 

{

 

RadGrid grid = new RadGrid();

 

grid.ID =

"radGridProducts";

 

grid.DataSourceID =

"objContDSProduct";

 

grid.AutoGenerateColumns =

false;

 

grid.AllowSorting =

true;

 

grid.AllowMultiRowSelection =

true;

 

grid.AllowMultiRowEdit =

true;

 

grid.GridLines =

GridLines.None ;

 

grid.Height =

Unit.Pixel(380);

 

grid.AllowPaging =

true;

 

grid.PageSize = 30;

 

ObjectContainerDataSource objContainer = new ObjectContainerDataSource();

 

objContainer.ID =

"objContDSProduct";

 

objContainer.DataObjectTypeName =

"GSBAU.Instr.DataAccess.Interface.BusinessEntities.InstrProduct";

 

objContainer.UsingServerPaging =

true;

 

 

String htmlColor = "#EDEFF1";

 

 

Color backColor = ColorTranslator.FromHtml(htmlColor);

 

grid.AlternatingItemStyle.BackColor = backColor;

 

String editColor = "#A2A2A2";

 

 

Color editbackColor = ColorTranslator.FromHtml(editColor);

 

grid.EditItemStyle.BackColor = editbackColor;

grid.EditItemStyle.Font.Name =

"arial";

 

grid.EditItemStyle.Font.Size =

new FontUnit("11px");

 

 

//grid.BorderColor = Color.Blue;

 

grid.MasterTableView.AllowPaging =

true;

 

grid.MasterTableView.PagerStyle.AlwaysVisible =

true;

 

grid.MasterTableView.PagerStyle.Position =

GridPagerPosition.TopAndBottom;

 

grid.MasterTableView.PagerStyle.Mode =

GridPagerMode.NextPrevNumericAndAdvanced;

 

grid.ClientSettings.AllowKeyboardNavigation =

true;

 

grid.ClientSettings.Selecting.AllowRowSelect=

true;

 

grid.ClientSettings.Scrolling.AllowScroll =

true;

 

grid.ClientSettings.Scrolling.UseStaticHeaders =

true;

 

grid.ClientSettings.Scrolling.ScrollHeight =

Unit.Pixel(300);

 

 

grid.FilterMenu.EnableTheming=

true;

 

grid.FilterMenu.CollapseAnimation.Duration = 200;

grid.FilterMenu.CollapseAnimation.Type =

AnimationType.OutQuint;

 

 

 

//Add Products Master table

 

grid.MasterTableView.Name =

"ProductParent";

 

grid.MasterTableView.PageSize = 30;

grid.MasterTableView.DataKeyNames =

new string[] { "Id", "ParentId","ProductLevel","Tag"};

 

grid.MasterTableView.EditMode =

GridEditMode.InPlace;

 

grid.MasterTableView.TableLayout =

GridTableLayout.Fixed;

 

 

//GridEditCommandColumn col0 = new GridEditCommandColumn();

 

 

//col0.ButtonType = GridButtonColumnType.ImageButton;

 

 

//col0.UpdateImageUrl = "../images/Update.gif";

 

 

//col0.EditImageUrl = "../images/Edit.gif";

 

 

//col0.InsertImageUrl = "../images/Insert.gif";

 

 

//col0.CancelImageUrl = "../images/Cancel.gif";

 

 

//col0.UniqueName = "EditCommandColumn";

 

 

//grid.MasterTableView.Columns.Add(col0);

 

 

//grid.MasterTableView.Columns[0].HeaderStyle.Width = Unit.Percentage(4);

 

 

//grid.MasterTableView.Columns[0].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;

 

 

//grid.MasterTableView.Columns[0].ItemStyle.HorizontalAlign = HorizontalAlign.Center;

 

 

GridButtonColumn col0 = new GridButtonColumn();

 

col0.Text =

"Delete";

 

col0.ConfirmText =

"Delete this product?";

 

col0.ButtonType =

GridButtonColumnType.ImageButton;

 

col0.ImageUrl =

"../images/Delete.gif";

 

col0.CommandName =

"Delete";

 

col0.UniqueName =

"DeleteColumn";

 

grid.MasterTableView.Columns.Add(col0);

grid.MasterTableView.Columns[0].HeaderStyle.Width =

Unit.Percentage(4);

 

grid.MasterTableView.Columns[0].HeaderStyle.HorizontalAlign =

HorizontalAlign.Center;

 

grid.MasterTableView.Columns[0].ItemStyle.HorizontalAlign =

HorizontalAlign.Center;

 

 

GridClientSelectColumn col1 = new GridClientSelectColumn();

 

col1.UniqueName =

"checkBoxColumn";

 

grid.MasterTableView.Columns.Add(col1);

grid.MasterTableView.Columns[1].HeaderStyle.Width =

Unit.Percentage(4);

 

grid.MasterTableView.Columns[1].HeaderStyle.HorizontalAlign =

HorizontalAlign.Center;

 

grid.MasterTableView.Columns[1].ItemStyle.HorizontalAlign =

HorizontalAlign.Center;

 

 

GridBoundColumn col2 = new GridBoundColumn();

 

col2.DataField =

"Tag";

 

col2.UniqueName = grid.MasterTableView.Name +

"colTag";

 

col2.HeaderText =

"Tag";

 

 

//col3.ReadOnly = true;

 

grid.MasterTableView.Columns.Add(col2);

 

//grid.MasterTableView.Columns[3].HeaderStyle.Width = Unit.Percentage(15);

 

 

GridBoundColumn col3 = new GridBoundColumn();

 

col3.DataField =

"ShortDescription";

 

col3.UniqueName = grid.MasterTableView.Name +

"colShortDescription";

 

col3.HeaderText =

"Short Description";

 

col3.MaxLength = 40;

grid.MasterTableView.Columns.Add(col3);

 

//grid.MasterTableView.Columns[4].HeaderStyle.Width = Unit.Percentage(15);

 

 

GridBoundColumn col4 = new GridBoundColumn();

 

col4.DataField =

"LongDescription";

 

col4.UniqueName = grid.MasterTableView.Name +

"colLongDescription";

 

col4.HeaderText =

"Long Description";

 

col4.MaxLength = 80;

grid.MasterTableView.Columns.Add(col4);

 

//grid.MasterTableView.Columns[5].HeaderStyle.Width = Unit.Percentage(25);

 

 

GridBoundColumn col5 = new GridBoundColumn();

 

col5.DataField =

"ShortDescription2";

 

col5.UniqueName = grid.MasterTableView.Name +

"colShortDescription2";

 

col5.HeaderText =

"Short Description 2";

 

col5.MaxLength = 40;

grid.MasterTableView.Columns.Add(col5);

col5.Visible =

false;

 

 

//grid.MasterTableView.Columns[6].HeaderStyle.Width = Unit.Percentage(15);

 

 

GridHyperLinkColumn col6 = new GridHyperLinkColumn();

 

col6.UniqueName = grid.MasterTableView.Name +

"colCharacteristics2";

 

col6.HeaderText =

"Characteristics";

 

col6.DataNavigateUrlFields =

new string[] { "Id", "LongDescription" };

 

col6.DataNavigateUrlFormatString =

"javascript:ShowCharacteristics('{0}', '{1}');";

 

col6.Text =

"View";

 

grid.MasterTableView.Columns.Add(col6);

 

//grid.MasterTableView.Columns[7].HeaderStyle.Width = Unit.Percentage(10);

 

 

GridHyperLinkColumn col7 = new GridHyperLinkColumn();

 

col7.UniqueName = grid.MasterTableView.Name +

"colSRP";

 

col7.HeaderText =

"Quality Checks";

 

col7.DataNavigateUrlFields =

new string[] { "Id", "LongDescription" };

 

col7.DataNavigateUrlFormatString =

"javascript:ShowSRPs('{0}','{1}');";

 

col7.DataTextField =

"SRPViewText";

 

 

//col8.Text = "View";

 

grid.MasterTableView.Columns.Add(col7);

 

//grid.MasterTableView.Columns[8].HeaderStyle.Width = Unit.Percentage(8);

 

 

 

//grid.NeedDataSource += new GridNeedDataSourceEventHandler(this.RadGridProducts_NeedDataSource);

 

grid.DetailTableDataBind +=

new GridDetailTableDataBindEventHandler(this.RadGridProducts_DetailTableDataBind);

 

grid.DeleteCommand +=

new GridCommandEventHandler(this.radGridProducts_DeleteCommand);

 

grid.UpdateCommand +=

new GridCommandEventHandler(this.RadGridProducts_UpdateCommand);

 

grid.InsertCommand +=

new GridCommandEventHandler(this.RadGridProducts_InsertCommand);

 

grid.ItemDataBound +=

new GridItemEventHandler(this.RadGridProducts_ItemDataBound);

 

objContainer.Selecting +=

new EventHandler<ObjectContainerDataSourceSelectingEventArgs>(this.objContDSProducts_Selecting);

 

grid.MasterTableView.CommandItemTemplate =

new ProductCommandItemTemplate();

 

grid.MasterTableView.CommandItemDisplay =

GridCommandItemDisplay.Top;

 

 

// Add the grid to the placeholder

 

 

this.radAjaxPnlProducts.Controls.Add(grid);

 

 

this.radAjaxPnlProducts.Controls.Add(objContainer);

 

}

#endregion

#region

 

RADPRODUCTGRID DATA BINDING

 

 

//protected void RadGridProducts_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

 

//{

 

 

// if (!e.IsFromDetailTable)

 

 

// {

 

 

// int dbId = (int)HttpContext.Current.Session["INSTR_ID"];

 

 

// List<InstrProduct> products = _presenter.PopulateProductsData(dbId);

 

 

// RadGrid grid = (RadGrid) source;

 

 

// grid.DataSource = products;

 

 

// }

 

 

//}

 

 

protected void objContDSProducts_Selecting(object sender, ObjectContainerDataSourceSelectingEventArgs e)

 

{

 

object objDbId = SessionManager.GetSessionObject("INSTR_ID");

 

 

if (objDbId != null)

 

{

 

int dbId = (int)objDbId;

 

 

int gridStartRowIndex = e.Arguments.StartRowIndex;

 

 

int startIndex = gridStartRowIndex + 1;

 

 

int endIndex = gridStartRowIndex + e.Arguments.MaximumRows;

 

 

ObjectContainerDataSource objContDS = radAjaxPnlProducts.FindControl("objContDSProduct") as ObjectContainerDataSource;

 

objContDS.DataSource = _presenter.PopulateProductsData(dbId, startIndex, endIndex);

objContDS.TotalRowCount = _presenter.GetProductsCount(dbId);

}

}

 

protected void RadGridProducts_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)

 

{

 

GridDataItem parentItem = e.DetailTableView.ParentItem;

 

 

int productId = Convert.ToInt32(parentItem.GetDataKeyValue("Id"));

 

 

string[] datakeyNames = { "Id","ParentId","ProductLevel","Tag" };

 

e.DetailTableView.DataKeyNames = datakeyNames;

 

GridRelationFields relationFields = new GridRelationFields

 

{

MasterKeyField =

"Id",

 

DetailKeyField =

"ParentId"

 

};

 

String htmlColor = "#6699CC";

 

 

//Color backColor = ColorTranslator.FromHtml(htmlColor);

 

 

//e.DetailTableView.HeaderStyle.BackColor = backColor;

 

e.DetailTableView.ParentTableRelation.Add(relationFields);

e.DetailTableView.Width =

Unit.Percentage(100);

 

 

//e.DetailTableView.BorderColor = Color.Blue;

 

e.DetailTableView.DataSource = _presenter.GetChildProducts(productId);

 

}

 

 

protected void RadGridProducts_ItemDataBound(object sender, GridItemEventArgs e)

 

{

 

if (e.Item is GridDataItem && !(e.Item is GridDataInsertItem))

 

{

 

int productCnt = Convert.ToInt32(((InstrProduct)e.Item.DataItem).ProductChildCount);

 

 

if (productCnt == 0)

 

{

e.Item.Cells[0].Controls[0].Visible =

false;

 

 

//Added to help empty cell render correctly

 

e.Item.Cells[0].Text =

"&nbsp;";

 

}

}

}

 

#endregion

#region

 

PRODUCT HIERARCHY

 

 

private void CreateHierarchyTableTemplates(int noOfLevels,RadGrid grid)

 

{

 

GridTableView parentTableView = grid.MasterTableView;

 

parentTableView.DetailTables.Clear();

 

for (int i = 0; i < noOfLevels; i++)

 

{

 

GridTableView newParentTableView = CreateProductChildGrid(parentTableView,grid);

 

parentTableView = newParentTableView;

}

}

 

private GridTableView CreateProductChildGrid(GridTableView parentGridTableView,RadGrid grid)

 

{

 

GridTableView tableViewChildProduct = new GridTableView(grid);

 

parentGridTableView.DetailTables.Add(tableViewChildProduct);

tableViewChildProduct.DataSource =

new List<InstrProduct>();

 

AddProductChildGridAttributes(tableViewChildProduct);

tableViewChildProduct.EnableColumnsViewState =

true;

 

 

return tableViewChildProduct;

 

}

 

private void AddProductChildGridAttributes(GridTableView tableViewChildProduct)

 

{

 

//tableViewChildProduct.Width = Unit.Percentage(100);

 

tableViewChildProduct.AutoGenerateColumns =

false;

 

tableViewChildProduct.EnableViewState =

true;

 

tableViewChildProduct.HierarchyLoadMode =

GridChildLoadMode.ServerOnDemand;

 

 

 

//tableViewChildProduct.BorderColor = Color.Blue;

 

AddProductChildGridBoundColumns(tableViewChildProduct);

tableViewChildProduct.EnableColumnsViewState =

true;

 

tableViewChildProduct.EditMode =

GridEditMode.InPlace;

 

tableViewChildProduct.AllowPaging =

false;

 

tableViewChildProduct.CommandItemDisplay =

GridCommandItemDisplay.Top;

 

tableViewChildProduct.CommandItemSettings.AddNewRecordText =

"Add new product";

 

 

}

 

private void AddProductChildGridBoundColumns(GridTableView tableViewChildProduct)

 

{

 

//GridEditCommandColumn col0 = new GridEditCommandColumn();

 

 

//tableViewChildProduct.Columns.Add(col0);

 

 

//col0.ButtonType = GridButtonColumnType.ImageButton;

 

 

//col0.UpdateImageUrl = "../images/Update.gif";

 

 

//col0.EditImageUrl = "../images/Edit.gif";

 

 

//col0.InsertImageUrl = "../images/Insert.gif";

 

 

//col0.CancelImageUrl = "../images/Cancel.gif";

 

 

//col0.UniqueName = "EditCommandColumn";

 

 

//tableViewChildProduct.Columns[0].HeaderStyle.Width = Unit.Percentage(4);

 

 

//tableViewChildProduct.Columns[0].HeaderStyle.HorizontalAlign = HorizontalAlign.Center;

 

 

//tableViewChildProduct.Columns[0].ItemStyle.HorizontalAlign = HorizontalAlign.Center;

 

 

GridButtonColumn col0 = new GridButtonColumn();

 

tableViewChildProduct.Columns.Add(col0);

col0.Text =

"Delete";

 

col0.ConfirmText =

"Delete this product?";

 

col0.ButtonType =

GridButtonColumnType.ImageButton;

 

col0.ImageUrl =

"../images/Delete.gif";

 

col0.CommandName =

"Delete";

 

col0.UniqueName =

"DeleteColumn";

 

tableViewChildProduct.Columns[0].HeaderStyle.Width =

Unit.Percentage(4);

 

tableViewChildProduct.Columns[0].HeaderStyle.HorizontalAlign =

HorizontalAlign.Center;

 

tableViewChildProduct.Columns[0].ItemStyle.HorizontalAlign =

HorizontalAlign.Center;

 

 

GridClientSelectColumn col1 = new GridClientSelectColumn();

 

tableViewChildProduct.Columns.Add(col1);

tableViewChildProduct.Columns[1].HeaderStyle.Width =

Unit.Percentage(4);

 

tableViewChildProduct.Columns[1].HeaderStyle.HorizontalAlign =

HorizontalAlign.Center;

 

tableViewChildProduct.Columns[1].ItemStyle.HorizontalAlign =

HorizontalAlign.Center;

 

 

GridBoundColumn col2 = new GridBoundColumn();

 

tableViewChildProduct.Columns.Add(col2);

col2.DataField =

"Tag";

 

col2.UniqueName = tableViewChildProduct.Name +

"colTag";

 

col2.HeaderText =

"Tag";

 

col2.MaxLength = 10;

 

//tableViewChildProduct.Columns[3].HeaderStyle.Width = Unit.Percentage(15);

 

 

 

GridBoundColumn col3 = new GridBoundColumn();

 

tableViewChildProduct.Columns.Add(col3);

col3.DataField =

"ShortDescription";

 

col3.UniqueName = tableViewChildProduct.Name +

"colShortDescription";

 

col3.HeaderText =

"Short Description";

 

col3.MaxLength = 40;

 

//tableViewChildProduct.Columns[4].HeaderStyle.Width = Unit.Percentage(15);

 

 

GridBoundColumn col4 = new GridBoundColumn();

 

tableViewChildProduct.Columns.Add(col4);

col4.DataField =

"LongDescription";

 

col4.UniqueName = tableViewChildProduct.Name +

"colLongDescription";

 

col4.HeaderText =

"Long Description";

 

col4.MaxLength = 80;

 

//tableViewChildProduct.Columns[5].HeaderStyle.Width = Unit.Percentage(25);

 

 

GridBoundColumn col5 = new GridBoundColumn();

 

tableViewChildProduct.Columns.Add(col5);

col5.DataField =

"ShortDescription2";

 

col5.UniqueName = tableViewChildProduct.Name +

"colShortDescription2";

 

col5.HeaderText =

"Short Description 2";

 

col5.MaxLength = 80;

 

//tableViewChildProduct.Columns[6].HeaderStyle.Width = Unit.Percentage(15);

 

 

 

GridHyperLinkColumn col6 = new GridHyperLinkColumn();

 

tableViewChildProduct.Columns.Add(col6);

col6.UniqueName = tableViewChildProduct.Name +

"colCharacteristics2";

 

col6.HeaderText =

"Characteristics";

 

col6.DataNavigateUrlFormatString =

"javascript:ShowCharacteristics('{0}', '{1}');";

 

col6.DataNavigateUrlFields =

new string[] { "Id", "LongDescription" };

 

col6.Text =

"View";

 

 

//tableViewChildProduct.Columns[7].HeaderStyle.Width = Unit.Percentage(10);

 

 

GridHyperLinkColumn col7 = new GridHyperLinkColumn();

 

tableViewChildProduct.Columns.Add(col7);

col7.UniqueName = tableViewChildProduct.Name +

"colSRP";

 

col7.HeaderText =

"Quality Checks";

 

col7.DataNavigateUrlFields =

new string[] { "Id", "LongDescription" };

 

col7.DataNavigateUrlFormatString =

"javascript:ShowSRPs('{0}','{1}');";

 

col7.DataTextField =

"SRPViewText";

 

 

//col8.Text = "View";

 

 

//tableViewChildProduct.Columns[8].HeaderStyle.Width = Unit.Percentage(10);

 

}

#endregion

#region

 

PRODUCT MAINTENANCE

 

 

protected void RadGridProducts_InsertCommand(object source, GridCommandEventArgs e)

 

{

 

MessageObject messageObject = new MessageObject();

 

 

RadGrid sourceGrid = source as RadGrid;

 

 

 

int dbId = (int)HttpContext.Current.Session["INSTR_ID"];

 

 

bool insertStatus = false;

 

 

 

GridEditableItem insertedItem =e.Item.OwnerTableView.GetInsertItem();

 

 

//GridDataItem parentItem = (GridDataItem)insertedItem.OwnerTableView.ParentItem;

 

 

GridDataItem parentItem = (GridDataItem)e.Item.OwnerTableView.ParentItem;

 

 

 

int productLevel = 1;

 

 

int parentId = 0;

 

 

if (parentItem != null)

 

{

productLevel =

Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["productLevel"]);

 

productLevel = productLevel + 1;

 

//parentTag = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["Tag"].ToString();

 

parentId =

Convert.ToInt32(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["Id"]);

 

}

 

Hashtable newValues = new Hashtable();

 

 

//The GridTableView will fill the values from all editable columns in the hash

 

e.Item.OwnerTableView.ExtractValuesFromItem(newValues, insertedItem);

 

InstrProduct updatedProduct = new InstrProduct();

 

updatedProduct.Tag = newValues[

"Tag"].ToString();

 

updatedProduct.ShortDescription = newValues[

"ShortDescription"].ToString();

 

updatedProduct.LongDescription = newValues[

"LongDescription"].ToString();

 

updatedProduct.ProductLevel = productLevel;

updatedProduct.ParentId = parentId;

 

//GS_CLT_DB_PR_ID_SEQ

 

 

//insertStatus = _presenter.OnInsertProducts(dbId,updatedProduct);

 

 

//if (insertStatus)

 

 

//{

 

 

// DisplayMessage(false, "Product(s) Inserted Successfully.");

 

 

//}

 

 

//else

 

 

//{

 

 

// DisplayMessage(true, "Error Inserting Product(s).");

 

 

//}

 

 

//GS_CLT_DB_PR_ID_SEQ

 

messageObject = _presenter.OnInsertProducts(dbId, updatedProduct);

 

if (messageObject.MessageType == 0)

 

 

//if (insertStatus)

 

{

DisplayMessage(

false, "Product(s) Inserted Successfully.");

 

}

 

else

 

{

DisplayMessage(

true, "Error Inserting Product(s). Error Message: " + messageObject.Message);

 

}

}

 

protected void RadGridProducts_UpdateCommand(object source, GridCommandEventArgs e)

 

{

 

MessageObject messageObj = new MessageObject();

 

 

RadGrid sourceGrid = source as RadGrid;

 

 

int dbId = (int)HttpContext.Current.Session["INSTR_ID"];

 

 

List<InstrProduct> editedProducts = new List<InstrProduct>();

 

 

 

bool updateStatus = false;

 

 

 

//foreach (GridEditableItem editedItem in sourceGrid.EditItems)

 

 

//{

 

 

GridEditableItem editedItem = (GridEditableItem) e.Item;

 

 

int productID = Convert.ToInt32(editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Id"]);

 

 

 

Hashtable newValues = new Hashtable();

 

 

//The GridTableView will fill the values from all editable columns in the hash

 

e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);

 

InstrProduct updatedProduct = new InstrProduct();

 

updatedProduct.Id = productID;

updatedProduct.Tag = newValues[

"Tag"].ToString();

 

updatedProduct.ShortDescription = newValues[

"ShortDescription"].ToString();

 

updatedProduct.LongDescription = newValues[

"LongDescription"].ToString();

 

 

//updateStatus = _presenter.OnSaveProductList(dbId, updatedProduct);

 

 

//if (updateStatus)

 

 

//{

 

 

// editedItem.Edit = false;

 

 

//}

 

messageObj = _presenter.OnSaveProductList(dbId, updatedProduct);

 

if (messageObj.MessageType == 0)

 

 

//if (updateStatus)

 

{

editedItem.Edit =

false;

 

}

 

//}

 

e.Item.OwnerTableView.Rebind();

 

if (messageObj.MessageType == 0)

 

 

//if (updateStatus)

 

{

DisplayMessage(

false, "Product(s) Updated Successfully.");

 

}

 

else

 

{

DisplayMessage(

true, "Error Updating Product(s). Error Message: " + messageObj.Message);

 

}

 

}

 

protected void radGridProducts_DeleteCommand(object source, GridCommandEventArgs e)

 

{

 

RadGrid grid = source as RadGrid;

 

 

GridItemCollection itemsCollection = grid.SelectedItems;

 

 

switch (e.CommandName)

 

{

//Delete Selected Products Logic

 

 

case "DeleteSelected":

 

{

 

if (itemsCollection.Count > 0)

 

{

 

StringBuilder _sProdList = new StringBuilder();

 

 

StringBuilder _sProdDeletedList = new StringBuilder();

 

 

foreach (GridDataItem item in itemsCollection)

 

{

 

String _productTag = item.GetDataKeyValue("Tag").ToString();

 

 

int _productId = Convert.ToInt32(item.GetDataKeyValue("Id"));

 

 

//Check if the productTag has a Child Level

 

 

List<InstrProduct> _lstProducts = _presenter.GetChildProducts(_productId);

 

 

if (_lstProducts.Count == 0)

 

{

 

//Allow Delete as there are no child products

 

 

InstrProduct _productDelete = new InstrProduct();

 

_productDelete.Id =

Convert.ToInt32(item.GetDataKeyValue("Id"));

 

 

//_productDelete.Tag = item.GetDataKeyValue("Tag").ToString();

 

 

//Allow Delete as there are no child products

 

 

int instrproductDel = _presenter.DeleteProduct(_productDelete);

 

e.Item.OwnerTableView.Rebind();

_sProdDeletedList.Append(_productTag);

_sProdDeletedList.Append(

" ");

 

}

 

else if (_lstProducts.Count > 0)

 

{

_sProdList.Append(_productTag);

_sProdList.Append(

" ");

 

}

}

 

//Allow Delete as there are no child products

 

 

StringBuilder _sMsgSuccess = new StringBuilder();

 

 

StringBuilder _sMsgFailure = new StringBuilder();

 

 

if (_sProdDeletedList.Length > 0)

 

{

 

//_sMsgDisplay.Append("Deleted Product List(s):");

 

_sMsgSuccess.Append(

"The following product(s) " + _sProdDeletedList + " have been deleted.");

 

DisplayMessage(

false, _sMsgSuccess.ToString());

 

}

 

if (_sProdList.Length > 0)

 

{

_sMsgFailure.Append(

"The following product(s) " + _sProdList + " cannot be deleted.Please delete all the child product(s) of these selected product(s).");

 

DisplayMessage(

true, _sMsgFailure.ToString());

 

}

}

 

break;

 

}

 

case "Delete":

 

{

 

//Delete single Product Logic

 

 

int _productId = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"]);

 

 

string _productTag = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Tag"].ToString();

 

 

StringBuilder _sMsgDisplay = new StringBuilder();

 

 

//Check if the productTag has a Child Level

 

 

List<InstrProduct> _lstProducts = _presenter.GetChildProducts(_productId);

 

 

if (_lstProducts.Count == 0)

 

{

 

//Allow Delete as there are no child products

 

 

InstrProduct _productDelete = new InstrProduct();

 

_productDelete.Id = _productId;

 

//_productDelete.Tag = _productTag;

 

 

//Allow Delete as there are no child products

 

 

int instrproductDel = _presenter.DeleteProduct(_productDelete);

 

 

//e.Item.OwnerTableView.Rebind();

 

_sMsgDisplay.Append(

"The following product " + _productTag + " have been deleted.");

 

DisplayMessage(

false, _sMsgDisplay.ToString());

 

}

 

else if (_lstProducts.Count > 0)

 

{

_sMsgDisplay.Append(

"The following product " + _productTag + " cannot be deleted.Please delete all the child product(s) of this selected product.");

 

DisplayMessage(

true, _sMsgDisplay.ToString());

 

}

e.Item.OwnerTableView.Rebind();

 

//RadAjaxManager1.WindowAlert(_sMsgDisplay.ToString());

 

}

 

break;

 

}

}

 

private void DisplayMessage(bool isError, string text)

 

{

 

this.lblSuccessMessage.Font.Bold = true;

 

 

this.lblSuccessMessage.Visible = true;

 

 

this.lblFailureMessage.Font.Bold = true;

 

 

this.lblFailureMessage.Visible = true;

 

 

if (isError)

 

{

 

this.lblFailureMessage.ForeColor = Color.Red;

 

 

this.lblFailureMessage.Text = text;

 

}

 

else

 

{

 

this.lblSuccessMessage.ForeColor = Color.Green;

 

 

this.lblSuccessMessage.Text = text;

 

}

}

#endregion

 

PRODUCT MAINTENANCE

 

#region

 

INTERNAL CLASSES

 

 

private class ProductCommandItemTemplate : ITemplate

 

{

 

protected LinkButton lnkBtnUpdate;

 

 

protected LinkButton lnkBtnDelete;

 

 

protected LinkButton lnkBtnCancel;

 

 

protected LinkButton lnkBtnAdd;

 

 

protected LinkButton lnkBtnSave;

 

 

protected LinkButton lnkBtnUpdateSelected;

 

 

protected LinkButton lnkBtnRefresh;

 

 

protected LinkButton lnkBtnViewAll;

 

 

 

protected ImageButton imgUpdate;

 

 

protected ImageButton imgDelete;

 

 

protected ImageButton imgCancel;

 

 

protected ImageButton imgAdd;

 

 

protected ImageButton imgSave;

 

 

protected ImageButton imgUpdateSelected;

 

 

protected ImageButton imgRefresh;

 

 

protected ImageButton imgViewAll;

 

 

protected Button btnSearch;

 

 

protected TextBox txtSearch;

 

 

 

public void InstantiateIn(Control container)

 

{

 

LiteralControl literalspace = new LiteralControl("&nbsp;&nbsp;");

 

 

GridItem itemGridProduct = container.NamingContainer as GridItem;

 

 

RadGrid gridProduct = itemGridProduct.OwnerTableView.OwnerGrid as RadGrid;

 

 

imgUpdate =

new ImageButton();

 

imgUpdate.ID =

"imgUpdateProducts";

 

imgUpdate.ImageUrl =

"../images/Update.gif";

 

imgUpdate.ImageAlign =

ImageAlign.Middle;

 

lnkBtnUpdate =

new LinkButton();

 

lnkBtnUpdate.ID =

"btnUpdateProducts";

 

lnkBtnUpdate.Text =

"Update Products";

 

lnkBtnUpdate.CommandName =

"UpdateEdited";

 

lnkBtnUpdate.CausesValidation =

false;

 

 

if (gridProduct.EditIndexes.Count > 0)

 

{

lnkBtnUpdate.Visible =

true;

 

imgUpdate.Visible =

true;

 

}

 

else

 

{

lnkBtnUpdate.Visible =

false;

 

imgUpdate.Visible =

false;

 

}

imgCancel =

new ImageButton();

 

imgCancel.ID =

"imgCancel";

 

imgCancel.ImageUrl =

"../images/Cancel.gif";

 

imgCancel.ImageAlign =

ImageAlign.Middle;

 

lnkBtnCancel =

new LinkButton();

 

lnkBtnCancel.ID =

"btnCancel";

 

lnkBtnCancel.Text =

"Cancel Editing";

 

lnkBtnCancel.CommandName =

"CancelAll";

 

lnkBtnCancel.CausesValidation =

false;

 

 

if (gridProduct.EditIndexes.Count > 0 || gridProduct.MasterTableView.IsItemInserted)

 

{

lnkBtnCancel.Visible =

true;

 

imgCancel.Visible =

true;

 

}

 

else

 

{

lnkBtnCancel.Visible =

false;

 

imgCancel.Visible =

false;

 

}

imgAdd =

new ImageButton();

 

imgAdd.ID =

"imgAddProduct";

 

imgAdd.ImageUrl =

"../images/AddRecord.gif";

 

imgAdd.ImageAlign =

ImageAlign.Middle;

 

lnkBtnAdd =

new LinkButton();

 

lnkBtnAdd.ID =

"btnAddProduct";

 

lnkBtnAdd.Text =

"Add new product";

 

lnkBtnAdd.CommandName =

"InitInsert";

 

lnkBtnAdd.CausesValidation =

false;

 

 

 

if (!gridProduct.MasterTableView.IsItemInserted)

 

{

lnkBtnAdd.Visible =

true;

 

imgAdd.Visible =

true;

 

}

 

else

 

{

lnkBtnAdd.Visible =

false;

 

imgAdd.Visible =

false;

 

}

imgSave =

new ImageButton();

 

imgSave.ID =

"imgSaveProduct";

 

imgSave.ImageUrl =

"../images/Insert.gif";

 

imgSave.ImageAlign =

ImageAlign.Middle;

 

lnkBtnSave =

new LinkButton();

 

lnkBtnSave.ID =

"btnSaveProduct";

 

lnkBtnSave.Text =

"Add this product";

 

lnkBtnSave.CommandName =

"PerformInsert";

 

lnkBtnSave.CausesValidation =

false;

 

 

if (gridProduct.MasterTableView.IsItemInserted)

 

{

lnkBtnSave.Visible =

true;

 

imgSave.Visible =

true;

 

}

 

else

 

{

lnkBtnSave.Visible =

false;

 

imgSave.Visible =

false;

 

}

 

//imgUpdateSelected = new ImageButton();

 

 

//imgUpdateSelected.ID = "imgUpdateEdited";

 

 

//imgUpdateSelected.ImageUrl = "../images/Edit.gif";

 

 

//imgUpdateSelected.ImageAlign = ImageAlign.Middle;

 

 

//lnkBtnUpdateSelected = new LinkButton();

 

 

//lnkBtnUpdateSelected.ID = "btnUpdateEdited";

 

 

//lnkBtnUpdateSelected.Text = "Edit selected products";

 

 

//lnkBtnUpdateSelected.CommandName = "EditSelected";

 

 

//lnkBtnUpdateSelected.CausesValidation = false;

 

 

//if (gridProduct.EditIndexes.Count == 0)

 

 

//{

 

 

// lnkBtnUpdateSelected.Visible = true;

 

 

// imgUpdateSelected.Visible = true;

 

 

//}

 

 

//else

 

 

//{

 

 

// lnkBtnUpdateSelected.Visible = false;

 

 

// imgUpdateSelected.Visible = false;

 

 

//}

 

 

imgDelete =

new ImageButton();

 

imgDelete.ID =

"imgDeleteSelectedProducts";

 

imgDelete.ImageUrl =

"../images/Delete.gif";

 

imgDelete.ImageAlign =

ImageAlign.Middle;

 

lnkBtnDelete =

new LinkButton();

 

lnkBtnDelete.ID =

"btnDeleteSelectedProducts";

 

lnkBtnDelete.Text =

"Delete Selected";

 

lnkBtnDelete.CommandName =

"DeleteSelected";

 

lnkBtnDelete.CausesValidation =

false;

 

lnkBtnDelete.OnClientClick =

"javascript:return confirm('Delete all selected Products?')";

 

imgRefresh =

new ImageButton();

 

imgRefresh.ID =

"imgRefresh";

 

imgRefresh.ImageUrl =

"../images/Refresh.gif";

 

imgRefresh.ImageAlign =

ImageAlign.Middle;

 

 

lnkBtnRefresh =

new LinkButton();

 

lnkBtnRefresh.ID =

"btnRefresh";

 

lnkBtnRefresh.Text =

"Refresh Product List";

 

lnkBtnRefresh.CommandName =

"RebindGrid";

 

lnkBtnRefresh.CausesValidation =

false;

 

 

 

int dbId = (int)HttpContext.Current.Session["INSTR_ID"];

 

imgViewAll =

new ImageButton();

 

imgViewAll.ID =

"imgViewAll";

 

imgViewAll.ImageUrl =

"../images/view.gif";

 

imgViewAll.ImageAlign =

ImageAlign.Middle;

 

lnkBtnViewAll =

new LinkButton();

 

lnkBtnViewAll.ID =

"btnViewAll";

 

lnkBtnViewAll.Text =

"View All Products";

 

lnkBtnViewAll.CausesValidation =

false;

 

lnkBtnViewAll.OnClientClick =

"javascript:ShowAllProducts('" + dbId + "')";

 

 

container.Controls.Add(imgUpdate);

container.Controls.Add(lnkBtnUpdate);

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

container.Controls.Add(imgCancel);

container.Controls.Add(lnkBtnCancel);

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

container.Controls.Add(imgAdd);

container.Controls.Add(lnkBtnAdd);

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

container.Controls.Add(imgSave);

container.Controls.Add(lnkBtnSave);

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

 

//container.Controls.Add(imgUpdateSelected);

 

 

//container.Controls.Add(lnkBtnUpdateSelected);

 

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

container.Controls.Add(imgDelete);

container.Controls.Add(lnkBtnDelete);

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

container.Controls.Add(imgRefresh);

container.Controls.Add(lnkBtnRefresh);

container.Controls.Add(literalspace);

container.Controls.Add(literalspace);

container.Controls.Add(imgViewAll);

container.Controls.Add(lnkBtnViewAll);

}

}

#endregion

}


Thanks and Regards
V.Balamurali

Georgi Krustev
Telerik team
 answered on 21 Jul 2009
1 answer
76 views
Hi,

I have a aspx page with a form on it that is ajaxified using a RadAjaxPanel. The aspx uses a master page.

I have hooked into the ClientEvents-OnResponseEnd event of the panel to fire a clientside javascript function (basically for manipulating the URL sent to Google Analytics).

The js function (trackAjax) is contained within the master page.

However, when first loading the page, I sometimes, but not always, get a javascript error in my browser "trackAjax is undefined".

Any ideas what may be causing this?

Thanks,

Matt

Sebastian
Telerik team
 answered on 21 Jul 2009
1 answer
132 views
I have a master detail grid table,
while insert/edit works fine for the master table,
and insert also work fine for the detail table,
the update doesn't work for the detail table,
am I missing anything?
Thanks
Mickey

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SFS_DBConnectionString %>"
            DeleteCommand="DELETE FROM [T_ROOMS] WHERE [ROOM_ID] = @ROOM_ID" InsertCommand="INSERT INTO [T_ROOMS] ([CUSTOMER_ID], [NAME], [ROOM_TYPE_ID], [ROOM_PARENT_ID], [CLIENT1PREFIX], [CLIENT2PREFIX], [TOOLTIP]) VALUES (@CUSTOMER_ID, @NAME, @ROOM_TYPE_ID, @ROOM_PARENT_ID, @CLIENT1PREFIX, @CLIENT2PREFIX, @TOOLTIP)"
            SelectCommand="SELECT * FROM [T_ROOMS] WHERE (([ROOM_PARENT_ID] = @ROOM_PARENT_ID) AND ([CUSTOMER_ID] = @CUSTOMER_ID)) ORDER BY [NAME]"
            UpdateCommand="UPDATE [T_ROOMS] SET [CUSTOMER_ID] = @CUSTOMER_ID, [NAME] = @NAME, [ROOM_TYPE_ID] = @ROOM_TYPE_ID, [ROOM_PARENT_ID] = @ROOM_PARENT_ID, [CLIENT1PREFIX] = @CLIENT1PREFIX, [CLIENT2PREFIX] = @CLIENT2PREFIX, [TOOLTIP] = @TOOLTIP WHERE [ROOM_ID] = @ROOM_ID">
            <SelectParameters>
                <asp:Parameter DefaultValue="0" Name="ROOM_PARENT_ID" Type="Int32" />
                <asp:ControlParameter ControlID="RadComboBox1" Name="CUSTOMER_ID" PropertyName="SelectedValue"
                    Type="Int32" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ROOM_ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="CUSTOMER_ID" Type="Int32" />
                <asp:Parameter Name="NAME" Type="String" />
                <asp:Parameter Name="ROOM_TYPE_ID" Type="Int16" />
                <asp:Parameter Name="ROOM_PARENT_ID" Type="Int32" />
                <asp:Parameter Name="CLIENT1PREFIX" Type="String" />
                <asp:Parameter Name="CLIENT2PREFIX" Type="String" />
                <asp:Parameter Name="TOOLTIP" Type="String" />
                <asp:Parameter Name="ROOM_ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:ControlParameter ControlID="RadComboBox1" Name="CUSTOMER_ID" PropertyName="SelectedValue"
                    Type="Int32" />
                <asp:Parameter Name="NAME" Type="String" />
                <asp:Parameter Name="ROOM_TYPE_ID" Type="Int16" />
                <asp:Parameter Name="ROOM_PARENT_ID" Type="Int32" DefaultValue="0" />
                <asp:Parameter Name="CLIENT1PREFIX" Type="String" />
                <asp:Parameter Name="CLIENT2PREFIX" Type="String" />
                <asp:Parameter Name="TOOLTIP" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:SFS_DBConnectionString %>"
            DeleteCommand="DELETE FROM [T_ROOMS] WHERE [ROOM_ID] = @ROOM_ID" InsertCommand="INSERT INTO [T_ROOMS] ([CUSTOMER_ID], [NAME], [ROOM_TYPE_ID], [ROOM_PARENT_ID], [CLIENT1PREFIX], [CLIENT2PREFIX], [TOOLTIP]) VALUES (@CUSTOMER_ID, @NAME, @ROOM_TYPE_ID, @ROOM_PARENT_ID, @CLIENT1PREFIX, @CLIENT2PREFIX, @TOOLTIP)"
            SelectCommand="SELECT * FROM [T_ROOMS] WHERE ([ROOM_PARENT_ID] = @ROOM_PARENT_ID) ORDER BY [NAME]"
            UpdateCommand="UPDATE [T_ROOMS] SET [CUSTOMER_ID] = @CUSTOMER_ID, [NAME] = @NAME, [ROOM_TYPE_ID] = @ROOM_TYPE_ID, [ROOM_PARENT_ID] = @ROOM_PARENT_ID, [CLIENT1PREFIX] = @CLIENT1PREFIX, [CLIENT2PREFIX] = @CLIENT2PREFIX, [TOOLTIP] = @TOOLTIP WHERE [ROOM_ID] = @ROOM_ID">
            <SelectParameters>
                <asp:Parameter Name="ROOM_PARENT_ID" Type="Int32" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="ROOM_ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="CUSTOMER_ID" Type="Int32" />
                <asp:Parameter Name="NAME" Type="String" />
                <asp:Parameter Name="ROOM_TYPE_ID" Type="Int16" />
                <asp:Parameter Name="ROOM_PARENT_ID" Type="Int32" />
                <asp:Parameter Name="CLIENT1PREFIX" Type="String" />
                <asp:Parameter Name="CLIENT2PREFIX" Type="String" />
                <asp:Parameter Name="TOOLTIP" Type="String" />
                <asp:Parameter Name="ROOM_ID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:ControlParameter ControlID="RadComboBox1" Name="CUSTOMER_ID" PropertyName="SelectedValue"
                    Type="Int32" />
                <asp:Parameter Name="NAME" Type="String" />
                <asp:Parameter Name="ROOM_TYPE_ID" Type="Int16" />
                <asp:Parameter Name="ROOM_PARENT_ID" Type="Int32" />
                <asp:Parameter Name="CLIENT1PREFIX" Type="String" />
                <asp:Parameter Name="CLIENT2PREFIX" Type="String" />
                <asp:Parameter Name="TOOLTIP" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:SFS_DBConnectionString %>"
            SelectCommand="SELECT [ROOM_TYPE_ID], [NAME] FROM [T_ROOMS_TYPES]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource9" runat="server" ConnectionString="<%$ ConnectionStrings:SFS_DBConnectionString %>"
            SelectCommand="SELECT [CUSTOMER_ID], [NAME] FROM [T_CUSTOMERS] ORDER BY [NAME]">
        </asp:SqlDataSource>
        <br />
        Select Customer :
        <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource9"
            DataTextField="NAME" DataValueField="CUSTOMER_ID" Skin="Sunset" AutoPostBack="true"
            OnDataBound="RadComboBox1_DataBound" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
        </telerik:RadComboBox>
        <br />
        <br />
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" Skin="Sunset"
            GridLines="None" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
            AllowSorting="True" AutoGenerateColumns="False">
            <MasterTableView DataKeyNames="ROOM_ID" DataSourceID="SqlDataSource1" EditMode="InPlace"
                CommandItemDisplay="TopAndBottom">
                <DetailTables>
                    <telerik:GridTableView runat="server" DataSourceID="SqlDataSource2" EditMode="InPlace"
                        AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="true"
                        CommandItemDisplay="TopAndBottom">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="ROOM_PARENT_ID" MasterKeyField="ROOM_ID" />
                        </ParentTableRelation>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px" />
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px" />
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridEditCommandColumn>
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn DataField="ROOM_ID" DataType="System.Int32" HeaderText="ROOM_ID"
                                ReadOnly="True" SortExpression="ROOM_ID" UniqueName="ROOM_ID" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CUSTOMER_ID" DataType="System.Int32" HeaderText="CUSTOMER_ID"
                                SortExpression="CUSTOMER_ID" UniqueName="CUSTOMER_ID" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="NAME" HeaderText="NAME" SortExpression="NAME"
                                UniqueName="NAME">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ROOM_TYPE_ID" DataType="System.Int16" HeaderText="ROOM_TYPE_ID"
                                SortExpression="ROOM_TYPE_ID" UniqueName="ROOM_TYPE_ID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="ROOM_PARENT_ID" DataType="System.Int32" HeaderText="ROOM_PARENT_ID"
                                SortExpression="ROOM_PARENT_ID" UniqueName="ROOM_PARENT_ID" Visible="False">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CLIENT1PREFIX" HeaderText="CLIENT1PREFIX" SortExpression="CLIENT1PREFIX"
                                UniqueName="CLIENT1PREFIX">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CLIENT2PREFIX" HeaderText="CLIENT2PREFIX" SortExpression="CLIENT2PREFIX"
                                UniqueName="CLIENT2PREFIX">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TOOLTIP" HeaderText="TOOLTIP" SortExpression="TOOLTIP"
                                UniqueName="TOOLTIP">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn Visible="True">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="ROOM_ID" DataType="System.Int32" HeaderText="ROOM_ID"
                        ReadOnly="True" SortExpression="ROOM_ID" UniqueName="ROOM_ID" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CUSTOMER_ID" DataType="System.Int32" HeaderText="CUSTOMER_ID"
                        SortExpression="CUSTOMER_ID" UniqueName="CUSTOMER_ID" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="NAME" HeaderText="NAME" SortExpression="NAME"
                        UniqueName="NAME">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ROOM_TYPE_ID" DataType="System.Int16" HeaderText="ROOM_TYPE_ID"
                        SortExpression="ROOM_TYPE_ID" UniqueName="ROOM_TYPE_ID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="ROOM_PARENT_ID" DataType="System.Int32" HeaderText="ROOM_PARENT_ID"
                        SortExpression="ROOM_PARENT_ID" UniqueName="ROOM_PARENT_ID" Visible="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CLIENT1PREFIX" HeaderText="CLIENT1PREFIX" SortExpression="CLIENT1PREFIX"
                        UniqueName="CLIENT1PREFIX">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CLIENT2PREFIX" HeaderText="CLIENT2PREFIX" SortExpression="CLIENT2PREFIX"
                        UniqueName="CLIENT2PREFIX">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="TOOLTIP" HeaderText="TOOLTIP" SortExpression="TOOLTIP"
                        UniqueName="TOOLTIP">
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>

Sebastian
Telerik team
 answered on 21 Jul 2009
2 answers
107 views
Ok, I need help understanding why this would be the case.  I'm assuming, of course, there is a reason for it.

I have a grid...
The Grid column widths are NOT set...
The Grid Header/Item/Footers are all set to wrap=false.
Scrolling is enabled.
Static Headers are enabled.

EDIT:  I should have stated this also.  The grid width is set to 100% so it will shrink/expand with the page.

Without a group active and without resizing active, the grid looks fine.  The headers and/or columns do wrap, and the grid srolls properly (horizontally) within its deisplayed area.

Now...  If I enable a Group...

The Grid seems to ignore the wrap setting, and reduces all the columns to fit in the visible area.  I'm not sure why, not to mention, I'm not sure why the wrap setting is ignored.

Also, seperately, if I enable resizing...  It appears to have a similar affect.

Am I asking too much of the grid to adhere to the wrap=false setting when grouping AND/OR activating resizing?

Also, as a side note, when resizing, on an ajax request, it doesn't remember the resize, and "re-squishes" :).  Now, I do create my columns programmatically on Page_Init, however, as I said, I don't set width, and wrapping is set to false.

Thanks!!!
Kuba
George
Top achievements
Rank 1
 answered on 21 Jul 2009
2 answers
220 views

Hello,

 

Trying to create a custum theme for my radgrid using the new visual theme builder.

 

I cant figure out the following:

 

I want a alternate row color.

But when the alternate row gets selected or hovered the color should change to the row selected or hovered color.

 

How can I realize this?

 

Kind regard,

 

Tim van Rooijen

IT Development
Top achievements
Rank 1
 answered on 21 Jul 2009
1 answer
84 views
Hi,

I'm having a problem to set the frozencolumn property. Actually when i use staticheader it's working fine but the first column is a but larger than the header. I've set all the headerstyle-width for each column but only the first column seems to have this problem.

Else if i set static header to false the frozencolumn isn't working but all my column width are the same. I've set the table-layout to fixed don't know if its suppose to change anything.

All my grid is dynamic and column are create in codebehind depending of the data source i receive.

Is there anyway to be able to correct the width or simply use frozencolumn alone without static header.

Again thx for your time!!

Guillaume
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
 answered on 21 Jul 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?