function
GridCreated(sender, args)
{
var scrollArea = sender.GridDataDiv;
var dataHeight = sender.get_masterTableView().get_element().clientHeight;
}
The problem I am having is that "sender.GridDataDiv" is coming back as NULL. Sender is not NULL, just Sender.GridDataDiv. Any ideas why?
Here is my grid markup:
<
telerik:RadGrid ID="rgUsers" runat="server" AutoGenerateColumns="false" AllowPaging="true" Width="850px" PagerStyle-Mode="NextPrevAndNumeric"
OnNeedDataSource="rgUsers_NeedDataSource" OnItemCommand="rgUsers_OnItemCommand" OnSelectedIndexChanged="rgUsers_OnSelectedIndexChanged" OnDataBound="rgUsers_OnDataBound"
OnInsertCommand="rgUsers_InsertCommand" OnUpdateCommand="rgUsers_UpdateCommand" ClientSettings-ClientEvents-OnRowCreated="rgUsers_Client_OnRowCreated"
ClientSettings-ClientEvents-OnMasterTableViewCreated="rgUsers_Client_OnMasterTableViewCreated" ClientSettings-ClientEvents-OnGridCreated="GridCreated">
<MasterTableView Width="100%" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage" DataKeyNames="GlobalId" ClientDataKeyNames="GlobalId">
<CommandItemSettings AddNewRecordText="Add User..." />
<Columns>
<telerik:GridTemplateColumn UniqueName="SelectUserColumn" >
<ItemTemplate>
<asp:CheckBox runat="server" ID="cbSelectUser" onclick="cbSelectUser_OnClick();" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn ButtonType="ImageButton" />
<telerik:GridBoundColumn DataField="GlobalId" UniqueName="GlobalIdColumn" Visible="false" ReadOnly="true" />
<telerik:GridTemplateColumn DataField="Username" UniqueName="UsernameColumn" HeaderText="Username" >
<ItemTemplate>
<asp:LinkButton ID="btnUserDetails" runat="server" CommandName="Select" CommandArgument='<%# Eval("GlobalId") %>' Text='<%# Eval("Username") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtUsername" runat="server" Text='<%# Eval("Username") %>' />
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridCheckBoxColumn DataField="StrongPassword" HeaderText="Strong Password" UniqueName="StrongPasswordColumn" />
<telerik:GridCheckBoxColumn DataField="PasswordExpires" HeaderText="Password Expires" UniqueName="PasswordExpiresColumn" />
<telerik:GridBoundColumn DataField="PasswordValidDays" HeaderText="Password Valid # Days" UniqueName="PasswordValidDaysColulmn" />
<telerik:GridDropDownColumn DataField="RoleId" DataSourceID="LinqRoleSource" HeaderText="Role" ListTextField="RoleName" ListValueField="RoleId" UniqueName="RoleColumn" />
<telerik:GridBoundColumn DataField="Person.FirstName" HeaderText="First Name" UniqueName="FirstNameColumn" />
<telerik:GridBoundColumn DataField="Person.LastName" HeaderText="Last Name" UniqueName="LastNameColumn" />
<telerik:GridDropDownColumn DataField="OrganizationId" DataSourceID="LinqOrgSource" UniqueName="OfficeColumn" HeaderText="Office" ListTextField="Name" ListValueField="OrganizationId" />
<telerik:GridBoundColumn DataField="OrganizationId" UniqueName="OrgIDColumn" Visible="true" />
</Columns>
<EditFormSettings EditColumn-ButtonType="ImageButton" EditColumn-UniqueName="EditColumn" UserControlName="~/UserControls/Users/EditUserDetails.ascx" EditFormType="WebUserControl" />
</MasterTableView>
</
telerik:RadGrid>
<telerik:RadComboBox ID="radBox" runat="server" EmptyMessage="Please Select" HighlightTemplatedItems="True"
AllowCustomText="True" OnClientDropDownClosed="onDropDownClosing"
Skin="Office2007">
<ItemTemplate>
<div onclick="StopPropagation(event)">
<asp:CheckBox runat="server" ID="selectBox" checked="false"
onclick="onBoxClick(this)" Text='<%#DataBinder.Eval(Container,"Text")%>'/>
In Cs File
protected void DataBind(){
//Code Omitted
radBox.DataSource = NameList;
radBox.DataValueField = "Id";
radBox.DataTextField = "Text";
radBox.DataBind();
}
Currently If I add a Select All as my List Item its coming as a Checkbox feature,I need to Select All the items on the first item click (How can I include that feature?) and not get that added as a text when selecting .
B) One more feature I would like to have is to limit the user not to enter any invalid characters in the Select All but keep the Empty Message string?
How can I bring that functionality apart from the one specified over here..(That is disabling the keypress) in http://www.telerik.com/community/forums/aspnet-ajax/combobox/how-can-i-show-a-message-at-the-top-of-combobox-like-choose-an-item.aspx
and here( where the empty client side text wont have the Italic Silver style for Rad Combo box)
http://www.telerik.com/community/forums/aspnet-ajax/combobox/set-radcombobox-to-empty-clientside.aspx
The exact problem I am facing here is :
I have normal drop down checkbox
and the Multiselect checkbox in One page.
When I set the style for Drop down checkbox to be AllowCustomText=true ,the empty message is coming and the user can enter everything in that combo box(One work around being disabling all the keypress in javascript code.Which I dont want, and I dont want a custom validator either.
In this forum I have found a way to set the empty text on load ,But that client code is not working,showing the radComboBox is null,when we try to execute the function

I've a SharePoint List named Promotions and following are sample data in it.
PromotionID Promotions Active
1 Promotion 1 Yes
2 Promotion 2 Yes
3 Promotion 3 No
4 Promotion 4 No
I also one another SharePoint list called StorePromotions
StorePromoID Promotions(Promotions List Look Up Column) Region(Regions List Look Up Column) ...
1 Promotion 4 Region 3
2 Promotion 3 Region 5
When I try to update the StorePromotion List, I choose Promotions from GridDropDownColumn(which I bind earlier with Promotions List) by getting the value from SelectedValue property(ie., storePromo.TradeName = tradeEditor.SelectedValue;). But when I update the list I get error, because I need the "PromotionID" and NOT the SelectedValue. Can anyone tell me how I can get that?
For more information, here is my code
StorePromotions.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StorePromotionsByTrade.aspx.cs"
Inherits="Heritage.Internet.UI.Pages.ContentManager.StorePromotionsByTrade,Heritage.Internet.UI.Pages.ContentManager,Culture=neutral, Version=1.0.0.0, PublicKeyToken=1202d49d749de830"
MasterPageFile="~/_layouts/HP/application.master" EnableSessionState="True"%>
<%@ Register Assembly="Telerik.Web.UI, Version=2010.1.309.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ID="Content1" contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server"></asp:Content>
<asp:Content ID="Content2" contentplaceholderid="PlaceHolderPageTitle" runat="server"></asp:Content>
<asp:Content ID="Content3" contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">Store Promotions assigned by TradeName</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderId="PlaceHolderPageDescription" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderId="PlaceHolderMain" runat="server">
<telerik:RadGrid ID="radGridStorePromotions" runat="server" GridLines="None" AutoGenerateColumns="false"
AllowPaging="true" AllowSorting="true" OnNeedDataSource="radGridStorePromotions_OnNeedDataSource"
OnItemDataBound="radGridStorePromotions_OnItemDataBound" OnItemCreated="radGridStorePromotions_ItemCreated"
OnUpdateCommand="radGridStorePromotions_OnUpdateCommand" >
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView TableLayout="Fixed" Height="100%" AllowFilteringByColumn="True">
<Columns>
<telerik:GridNumericColumn HeaderText="ID" DataField="ID" ReadOnly="true" Visible="false" UniqueName="PromoIdUniqueName" />
<telerik:GridDropDownColumn HeaderText="Promotion" UniqueName="PromotionsUniqueName"
DataField="Promotion" ListTextField="Promotion" ListValueField="Promotion" ListDataMember="Title" />
<telerik:GridDropDownColumn HeaderText="TradeName" UniqueName="TradeNameUniqueName"
DataField="TradeName" ListTextField="TradeName" ListValueField="TradeName" ListDataMember="Title"
DropDownControlType="RadComboBox" />
<telerik:GridDropDownColumn HeaderText="StoreLocation" UniqueName="StoreLocUniqueName"
DataField="StoreLocation" ListTextField="StoreLocation" ListValueField="StoreLocation"
ListDataMember="Title" />
<telerik:GridDateTimeColumn HeaderText="Start Date" UniqueName="StartDateUniqueName" DataField="StartDate" />
<telerik:GridDateTimeColumn HeaderText="End Date" UniqueName="EndDateUniqueName" DataField="EndDate" />
<telerik:GridCheckBoxColumn HeaderText="Active" UniqueName="ActiveUniqueName" DataField="Active" />
<telerik:GridEditCommandColumn HeaderText="Edit" UniqueName="EditCommandColumn" ButtonType="LinkButton"
EditText="Edit" UpdateText="Update" CancelText="Cancel" />
<telerik:GridButtonColumn HeaderText="Delete" UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</asp:Content>
And this is my StorePromotions.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Heritage.Internet.BLL.Promotions;
using Heritage.Internet.BOL.Promotions;
using Heritage.Internet.BLL.Regions;
using Heritage.Internet.BOL.Regions;
using Heritage.Internet.BLL.StoreLocations;
using Heritage.Internet.BOL.StoreLocations;
using Heritage.Internet.BLL.StorePromotions;
using Heritage.Internet.BOL.StorePromotions;
using Heritage.Internet.BLL.TradeNames;
using Heritage.Internet.BOL.TradeNames;
using Telerik.Web.UI;
namespace Heritage.Internet.UI.Pages.ContentManager
{
public partial class StorePromotionsByTrade : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
StorePromotionsBindData();
}
}
protected void radGridStorePromotions_OnNeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
if (Session["AllStorePromotions"] != null)
{
radGridStorePromotions.DataSource = Session["AllStorePromotions"];
}
else
{
StorePromotionsBindData();
}
}
protected void radGridStorePromotions_OnItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
GridEditableItem gridEditFormItem = (GridEditableItem)e.Item;
GridEditManager gridEditMan = gridEditFormItem.EditManager;
RadComboBox ddlTradeName = gridEditFormItem["TradeNameUniqueName"].Controls[0] as RadComboBox;
GridDropDownColumnEditor promotionsEditor = gridEditMan.GetColumnEditor("PromotionsUniqueName") as GridDropDownColumnEditor;
GridDropDownColumnEditor tradeEditor = gridEditMan.GetColumnEditor("TradeNameUniqueName") as GridDropDownColumnEditor;
GridDropDownColumnEditor storeEditor = gridEditMan.GetColumnEditor("StoreLocUniqueName") as GridDropDownColumnEditor;
//Get all ACTIVE Promotions in ASCENDING order and bind it to Promotions DropDownList
/****************************************************************/
//Storing the promotions in Session variable doesn't work.
//It binds StorePromotions varibales to Promotions DropDownList.
/****************************************************************/
Promotion promotionBLL = new Promotion();
List<PromotionEntity> promotions = new List<PromotionEntity>();
promotions = promotionBLL.GetAllPromotions();
object tempPromotions = promotionsEditor.DataSource;
promotionsEditor.DataSource = promotions;
promotionsEditor.DataBind();
promotionsEditor.DataSource = tempPromotions;
//Get ACTIVE Trade Names in ASCENDING order and bind it to TradeName DropDownList
TradeName tradeNameBLL = new TradeName();
List<TradeNameEntity> tradeNames = new List<TradeNameEntity>();
tradeNames = tradeNameBLL.GetAllTradeNames();
object tempTradeNames = tradeEditor.DataSource;
tradeEditor.DataSource = tradeNames;
tradeEditor.DataBind();
tradeEditor.SelectedValue = ddlTradeName.SelectedValue;
tradeEditor.DataSource = tempTradeNames;
//Get ACTIVE Stores filtered by Selected TardeName and bind it to StoreLocations DropDownList
StoreLocation storeLocBLL = new StoreLocation();
List<StoreLocationListEntity> storeLocationsList = new List<StoreLocationListEntity>();
storeLocationsList = storeLocBLL.GetStoresByTradeName(ddlTradeName.SelectedValue);
object tempDataSource = storeEditor.DataSource;
storeEditor.DataSource = storeLocationsList;
storeEditor.DataBind();
storeEditor.DataSource = tempDataSource;
}
}
protected void radGridStorePromotions_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
//the dropdown list will be the first control in the Controls collection of the corresponding cell
RadComboBox ddlTradeName = (e.Item as GridEditableItem)["TradeNameUniqueName"].Controls[0] as RadComboBox;
//attach SelectedIndexChanged event for the combobox control
ddlTradeName.AutoPostBack = true;
ddlTradeName.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(ddlTradeName_OnSelectedIndexChanged);
}
}
protected void ddlTradeName_OnSelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
GridEditableItem editedItem = (sender as RadComboBox).NamingContainer as GridEditableItem;
RadComboBox ddlStoreLoc = editedItem["StoreLocUniqueName"].Controls[0] as RadComboBox;
StoreLocation storeLocBLL = new StoreLocation();
List<StoreLocationListEntity> storeLocationsList = new List<StoreLocationListEntity>();
storeLocationsList = storeLocBLL.GetStoresByTradeName((editedItem["TradeNameUniqueName"].Controls[0] as RadComboBox).SelectedValue);
ddlStoreLoc.ClearSelection();
ddlStoreLoc.DataSource = storeLocationsList;
ddlStoreLoc.DataBind();
}
protected void radGridStorePromotions_OnUpdateCommand(object source, GridCommandEventArgs e)
{
GridEditableItem gridEditFormItem = (GridEditableItem)e.Item;
GridEditManager gridEditMan = gridEditFormItem.EditManager;
GridNumericColumnEditor idEditor = gridEditMan.GetColumnEditor("PromoIdUniqueName") as GridNumericColumnEditor;
GridDropDownColumnEditor promotionsEditor = gridEditMan.GetColumnEditor("PromotionsUniqueName") as GridDropDownColumnEditor;
GridDropDownColumnEditor tradeEditor = gridEditMan.GetColumnEditor("TradeNameUniqueName") as GridDropDownColumnEditor;
GridDropDownColumnEditor storeEditor = gridEditMan.GetColumnEditor("StoreLocUniqueName") as GridDropDownColumnEditor;
GridDateTimeColumnEditor startDtEditor = gridEditMan.GetColumnEditor("StartDateUniqueName") as GridDateTimeColumnEditor;
GridDateTimeColumnEditor endDtEditor = gridEditMan.GetColumnEditor("EndDateUniqueName") as GridDateTimeColumnEditor;
GridCheckBoxColumnEditor activeEditor = gridEditMan.GetColumnEditor("ActiveUniqueName") as GridCheckBoxColumnEditor;
StorePromotion storePromoBLL = new StorePromotion();
StorePromotionListEntity storePromo = new StorePromotionListEntity();
storePromo.ID = Convert.ToInt32(idEditor.Text);
storePromo.Promotion = promotionsEditor.SelectedValue;
int s = promotionsEditor.SelectedIndex;
string d = promotionsEditor.SelectedText;
storePromo.TradeName = tradeEditor.SelectedValue;
storePromo.StoreLocation = storeEditor.SelectedValue;
storePromo.StartDate = Convert.ToDateTime(startDtEditor.Text);
storePromo.EndDate = Convert.ToDateTime(endDtEditor.Text);
storePromo.Active = activeEditor.Value;
storePromoBLL.UpdateStorePromotionToList(storePromo);
StorePromotionsBindData();
}
private void StorePromotionsBindData()
{
//Get ALL Store Promotions in ASCENDING Order
StorePromotion storePromosBLL = new StorePromotion();
List<StorePromotionListEntity> storePromos = new List<StorePromotionListEntity>();
storePromos = storePromosBLL.GetStorePromotionsAssignedByTrade();
radGridStorePromotions.DataSource = storePromos;
Session["AllStorePromotions"] = storePromos;
radGridStorePromotions.DataBind();
}
}
}
I've finish this task by EOD tomorrow. If anyone could help me find this, it'd be really helpful.
Thank you.
K
this._middleRightBar.setAttribute("unselectable","on");
| <tr id="OptionsRow" runat="server"> |
| <td style="vertical-align: text-top;" colspan="2"> |
| <telerik:RadDockLayout ID="OptionsLayout" runat="server" EnableEmbeddedSkins="false"> |
| <telerik:RadDockZone runat="server" |
| ID="OptionsZone" |
| BorderWidth="0px" |
| BorderStyle="None"> |
| <telerik:RadDock runat="server" |
| ID="RadDockPriority" |
| EnableDrag="False" |
| Visible="true" |
| Collapsed="true" |
| BackColor="#000099" |
| Skin="Office2007" |
| DefaultCommands="None"> |
| Public Sub HideRow(ByRef row As HtmlTableRow) |
| If Not Account.IsDeveloper OrElse True Then |
| row.Attributes.Add("style", "display: none;") |
| Else |
| row.Attributes.Add("style", "background-color: #c0c0c0;") |
| End If |
| End Sub |
| function OnImgClick(sender, args) { |
| var wnd = window.radopen("/details.aspx?" + args, null); |
| } |
| <telerik:RadWindowManager ID="window" Width="900" Height="600" VisibleStatusbar="false" ShowContentDuringLoad="false" |
| Behaviors="Close, Move" runat="server" AutoSize="False" Modal="true" EnableViewState="true"> |
| </telerik:RadWindowManager> |