Add href link in custom grid in webform ASP.NET and Get ID of Select Row using JQuery - webforms

I am trying to add inside custom grid within template but I cannot see these links in output along with other grid data ....
<cc0:Grid ID="StaffItemList" runat="server" FolderStyle="~/Styles/Grid" AutoGenerateColumns="false"
Width="100%" PageSizeOptions="5,10,20,50,100,-1" AllowFiltering="true" FilterType="ProgrammaticOnly"
AllowAddingRecords="false">
<Columns>
<cc0:CheckBoxSelectColumn ShowHeaderCheckBox="true" Width="50" ControlStyle-CssClass="UserInRoleGrid"></cc0:CheckBoxSelectColumn>
<cc0:Column DataField="id" HeaderText="ID" Visible="true" />
<cc0:Column DataField="loginid" HeaderText="loginid" Width="150" />
<cc0:Column DataField="forenames" HeaderText="forenames" />
<cc0:Column DataField="surnames" HeaderText="surnames" />
<cc0:Column DataField="gender" HeaderText="gender" />
<cc0:Column DataField="email" HeaderText="email" />
<cc0:Column DataField="deleted" HeaderText="deleted" />
</Columns>
<Templates>
<cc0:GridTemplate runat="server" ID="AddUserToRoleLink">
<Template>
addRole
</Template>
</cc0:GridTemplate>
</Templates>
</cc0:Grid>

I have found asnswer; code as following....
<cc0:Grid ID="StaffItemList" runat="server" FolderStyle="~/Styles/Grid" AutoGenerateColumns="false"
Width="100%" PageSizeOptions="5,10,20,50,100,-1" AllowFiltering="true" FilterType="ProgrammaticOnly"
AllowAddingRecords="false">
<Columns>
<cc0:Column DataField="id" HeaderText="ID" Visible="true"/>
<cc0:Column DataField="loginid" HeaderText="loginid" Width="150" />
<cc0:Column DataField="forenames" HeaderText="forenames" />
<cc0:Column DataField="surnames" HeaderText="surnames" />
<cc0:Column DataField="gender" HeaderText="gender" />
<cc0:Column DataField="email" HeaderText="email" />
<cc0:Column DataField="deleted" HeaderText="deleted" />
<cc0:Column DataField="Functions" HeaderText="deleted" >
<TemplateSettings TemplateId="AddUserToRoleControl"/>
</cc0:Column>
</Columns>
<Templates>
<cc0:GridTemplate runat="server" ID="AddUserToRoleControl">
<Template>
Add Role
</Template>
</cc0:GridTemplate>
</Templates>
</cc0:Grid>
jQuery
<script type="text/javascript">
$(document).ready(function () {
$(".AddStaffToRoleLink").on("click", function () {
var selectedStaffID = $(this).attr("id");
alert("this is " + selectedStaffID);
});
});
</script>

Related

RadGrid not updating after Filter and Rebind

My problem is that I have 2 radgrids on a page and I cannot filter the columns.
One table is created like this:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="demo-container" id="demo-container">
<div class="gridPositioning">
<div>
<telerik:RadGrid ID="mdegGrid" runat="server"
AllowPaging="True" AllowCustomPaging="true"
AllowSorting="True"
AllowFilteringByColumn="True"
OnNeedDataSource="mdegGrid_NeedDataSource"
OnItemCommand="mdegGrid_ItemCommand"
OnItemCreated="mdegGrid_ItemCreated"
OnItemDataBound="mdegGrid_ItemDataBound"
OnPreRender="mdegGrid_PreRender"
CellSpacing="0" GridLines="None"
EnableLinqExpressions="false"
PageSize="12"
PagerStyle-AlwaysVisible="true"
EnableEmbeddedSkins="False"
Skin="_HBB"
CellPadding="0"
MasterTableView-CellSpacing="0" >
<GroupingSettings CaseSensitive="false" />
<MasterTableView AutoGenerateColumns="false" TableLayout="Auto" HierarchyLoadMode="ServerOnDemand"
DataKeyNames="ImportID" CommandItemDisplay="None" InsertItemPageIndexAction="ShowItemOnFirstPage">
<CommandItemSettings ShowRefreshButton="false" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn UniqueName="ImportID" HeaderText="<%$ Resources:HBS, Import_ID %>" DataField="ImportID_Filter"
SortExpression="ImportID"
FilterControlWidth="99%" ShowFilterIcon="false"
AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
<HeaderStyle ForeColor="Silver" Height="20px" Width="7%" HorizontalAlign="Left"></HeaderStyle>
<ItemStyle ForeColor="Gray" Height="20px" Width="7%" HorizontalAlign="Left"></ItemStyle>
</telerik:GridBoundColumn>
In the code behind in the mdeGrid_PreRender funtion I have the following code:
mdegGrid.MasterTableView.FilterExpression = string.Format("([{0}] LIKE N\'%{1}%\') ", _columnNameImports, txt.Text);
GridColumn column = mdegGrid.MasterTableView.GetColumnSafe(_columnNameImports);
column.CurrentFilterFunction = GridKnownFunction.Contains;
column.CurrentFilterValue = txt.Text;
mdegGrid.MasterTableView.Rebind();
UpdatePanel2.Update();
The problem is that nothing is happening. The grid becomes disabled with a Please wait loading message but after that, no filtering is happening.

RadTextBox Enter Key Closes the Browser Tab

I am having a RadTextBox in my page. This control is one of the search criteria to bring the results. The issue is, if I focus on the text box and press enter, the browser window / tab closes immediately. The RadTextBox tag does not have anything other than the runat, ID attributes.
Please share if you have faced a similar issue like this and found a solution.
Source Code:
<%# Control Language="C#" AutoEventWireup="True" Inherits="Controls_ProductListControl_ProductListControl"
CodeBehind="ProductListControl.ascx.cs" ClientIDMode="AutoID" %>
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script language="javascript" type="text/javascript">
ProductList = {
openAdd: function (catID) {
PopupWindow.open('/ProductCatalog/Popups/AddNewProductDialog.aspx?PID=0&PAID=0&CID=' + catID, 960, 700, ProductList.refreshGrid);
return false;
},
refreshGrid: function () {
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("refreshGrid");
},
onRequestStart: function (sender, args) {
if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
args.get_eventTarget().indexOf("ExportToCsvButton") >= 0 ||
args.get_eventTarget().indexOf("ExportToPdfButton") >= 0) {
args.set_enableAjax(false);
}
}
}
</script>
</telerik:RadScriptBlock>
<div class="heading">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="LinkButtonSearch">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridProducts" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="LinkButtonShowAll">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridProducts" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGridProducts">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridProducts" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<asp:Label ID="LabelProductName" runat="server" Text="<%$ Resources:UI, ProductListControl_Text_LabelProductName %>" />
<telerik:RadTextBox ID="RadTextBoxProductName" runat="server" MaxLength="50"></telerik:RadTextBox>
<asp:Label ID="LabelProductID" runat="server" Text="<%$ Resources:UI, ProductListControl_Text_LabelProductID %>" />
<telerik:RadNumericTextBox ID="RadNumericTextBoxProductID" runat="server" Width="100px"
DataType="System.Int32" MaxLength="9" MaxValue="999999999" MinValue="1" Style="text-align: center">
<NumberFormat DecimalDigits="0" GroupSeparator="" />
</telerik:RadNumericTextBox>
<asp:Label ID="LabelRuleID" runat="server" Text="<%$ Resources:UI, ProductListControl_Text_LabelRuleID %>" Visible="false" />
<telerik:RadTextBox ID="RadTextBoxRuleID" runat="server" Visible="false" />
<asp:LinkButton ID="LinkButtonSearch" runat="server" OnClick="LinkButtonSearch_Click"><%= Resources.UI.ProductListControl_HTML_Search %></asp:LinkButton>
<asp:placeholder ID="Placeholder2" runat="server"><img src="<%= Resources.UI.ProductListControl_HTML_ImagesSearchPng %>" width="14" height="14" alt="<%= Resources.UI.ProductListControl_HTML_Search_1 %>" /></asp:placeholder>
<asp:LinkButton ID="LinkButtonShowAll" runat="server" OnClick="LinkButtonShowAll_Click"><%= Resources.UI.ProductListControl_HTML_ShowAll %> </asp:LinkButton>
<asp:LinkButton ID="LinkButtonAddNew" runat="server"><%= Resources.UI.ProductListControl_HTML_AddNewProduct %></asp:LinkButton>
<asp:LinkButton ID="LinkButtonCopyProducts" runat="server" OnClientClick="window.open('/ProductCatalog/CopyProducts.aspx?catid=0','CopyProducts');"><%= Resources.UI.ProductListControl_HTML_CopyProducts %></asp:LinkButton>
</div>
<br />
<div class="fullrow">
<telerik:RadGrid ID="RadGridProducts" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" OnNeedDataSource="RadGridProducts_NeedDataSource" Visible="False" Skin="Windows7" OnItemDataBound="RadGridProducts_ItemDataBound">
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<%--<CommandItemSettings ExportToPdfText="<%$ Resources:UI, ProductListControl_ExportToPdfText_ExportToPdf %>"></CommandItemSettings>--%>
<Columns>
<telerik:GridBoundColumn DataField="pcProductId" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_Product_ID %>" ReadOnly="True" UniqueName="ProductID">
</telerik:GridBoundColumn>
<telerik:GridHyperLinkColumn DataTextField="ExtProductName" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ProductName %>"
UniqueName="ProductDetailLink" DataNavigateUrlFields="pcProductId" DataNavigateUrlFormatString="~/ProductCatalog/ProductDetail2.aspx?PID={0}"> </telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn DataField="ExtEffectiveDate" DataFormatString="{0:d}"
HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_EffectiveDate %>" UniqueName="EffectiveDate"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtPositions" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtPositions %>" ReadOnly="True"
UniqueName="Positions"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtRatingType" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtRatingType %>" ReadOnly="True"
UniqueName="RatingType"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtBaseBillRate" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtBaseBillRate %>"
ReadOnly="True" UniqueName="BaseBillRate" DataFormatString="{0:0.00}" FilterControlWidth="30px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtBasePayRate" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtBasePayRate %>" ReadOnly="True"
UniqueName="BasePayRate" DataFormatString="{0:0.00}" FilterControlWidth="30px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtMargin" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtMargin %>" ReadOnly="True"
UniqueName="Margin" DataFormatString="{0:0.00}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtEntityName" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtEntityName %>" ReadOnly="True"
UniqueName="EntityName"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtProductStatus" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtProductStatus %>" UniqueName="Status">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid></div>
Thanks,
Sriram

Telerik RadGrid Issue:No SelectedItems are shown on Buttonclick although few items are being selected

I have two RadGrids on my aspx page and have used one search TextBox to search items from the RadGrid.
There's a button on click of which the selected items are transferred to other grid.
The problem is when i search the items with particular key word and then select items from the RadGrid and click the button. No action is performed and in the code behint it shows no data items selected. Then if I again select from the searched list and click the button it works fine.
function requestStart(sender, args) {
if (args.get_eventTarget().indexOf("ButtonPrint") > 0
||
args.get_eventTarget().indexOf("ButtonSelect") > 0
)
args.set_enableAjax(false);
}
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="EnrollmentPanel">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="EnrollmentPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ButtonEnroll">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadGrid ID="EnrollmentGrid" runat="server" Width="100%" GridLines="None"
AllowPaging="True" ShowStatusBar="true" AutoGenerateColumns="false" DataSourceID="CourseCreditDS"
OnItemCommand="EnrollmentGrid_ItemCommand" OnItemDataBound="EnrollmentGrid_ItemDataBound">
<MasterTableView DataKeyNames="pid" CommandItemDisplay="None">
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="20px" />
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="<%$ Resources: Manager, EditCredit %>"
Visible="false" />
<telerik:GridTemplateColumn UniqueName="AssignedColumn" Visible="false" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:Image runat="server" ImageUrl="~/Contents/Images/tick.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolled %>" Visible='<%# Eval("enrolled").ToString() == "Y" %>' />
<asp:Image runat="server" ImageUrl="~/Contents/Images/error.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolledOther %>" Visible='<%# Eval("already_assigned").ToString() == "Y" %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, StudentId %>" DataTextField="pid"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="pid" Target="_blank" />
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, Name %>" DataTextField="name"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="lname" Target="_blank" />
<telerik:GridBoundColumn HeaderText="<%$ Resources: Manager, Division %>" DataField="div_name"
SortExpression="div_name" />
<telerik:GridTemplateColumn UniqueName="ResultColumn" HeaderText="<%$ Resources: Manager, Result %>"
Visible="false">
<ItemTemplate>
<asp:Literal ID="ResultText" runat="server" Text="<%$ Resources: Manager, EmptyDataText %>" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="CapIdColumn" HeaderText="<%$ Resources: Manager, CapId %>"
DataField="ot1" SortExpression="ot1" ConvertEmptyStringToNull="true" EmptyDataText="<%$ Resources: Manager, EmptyDataText %>"
Visible="false" />
<telerik:GridTemplateColumn UniqueName="AttachColumn" Visible="false" HeaderText="Attachment">
<ItemTemplate>
<table>
<tr>
<td>
<telerik:RadAsyncUpload ID="CCFileUploader" runat="server" PostbackTriggers="btnUploadPost" OnFileUploaded="CCFileUploader_FileUploaded" OnClientFileUploaded="CCFileUploader_ClientFileUploaded" UploadedFilesRendering="BelowFileInput" />
</td>
<td>
<asp:Button ID="btnUploadPost" runat="server" CausesValidation="false" Text="hidden" Style="display: none" /></td>
<td>
<asp:LinkButton ID="CCExistingUploadsLink" runat="server" Text="<%$ Resources: Manager, NoExistingAttachments %>" Enabled="false" Style="text-decoration: none; color: #769e1a;" />
<asp:HiddenField ID="CCPid" runat="server" Visible="false" Value='<%# Eval("pid")%>' />
</td>
</tr>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditItemStyle CssClass="EditedItem" />
<EditFormSettings UserControlName="~/Courses/Template/CourseCredit.ascx" EditFormType="WebUserControl">
<FormStyle BackColor="White" />
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
</ClientSettings>
<ExportSettings IgnorePaging="true" OpenInNewWindow="true">
<Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Training Session" />
</ExportSettings>
</telerik:RadGrid>
<telerik:RadGrid ID="EnrollListGrid" runat="server" Width="100%" GridLines="None" AllowPaging="true" PageSize="10" ShowStatusBar="true" AllowMultiRowSelection="true" AutoGenerateColumns="false" OnDetailTableDataBind="EnrollListGrid_DetailTableDatabind"
OnNeedDataSource="EnrollListGrid_OnNeedDataSource" OnPreRender="EnrollListGrid_OnPreRender">
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView AllowMultiColumnSorting="true" DataKeyNames="listname">
<DetailTables>
<telerik:GridTableView DataKeyNames="pid" Name="DetailList">
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="20px">
<HeaderStyle Width="20px" />
</telerik:GridClientSelectColumn>
<telerik:GridTemplateColumn UniqueName="AssignedColumn" Visible="false" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Contents/Images/tick.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolled %>" Visible='<%# Eval("enrolled").ToString() == "Y" %>' />
<asp:Image ID="Image2" runat="server" ImageUrl="~/Contents/Images/error.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolledOther %>" Visible='<%# Eval("already_assigned").ToString() == "Y" %>' />
</ItemTemplate>
<HeaderStyle Width="60px" />
</telerik:GridTemplateColumn>
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, StudentId %>" DataTextField="pid"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="pid" Target="_blank" />
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, Name %>" DataTextField="name"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="lname" Target="_blank" />
<telerik:GridBoundColumn HeaderText="<%$ Resources: Manager, Division %>" DataField="div_name"
SortExpression="div_name" />
<telerik:GridBoundColumn UniqueName="CapIdColumn" HeaderText="<%$ Resources: Manager, CapId %>"
DataField="ot1" SortExpression="ot1" ConvertEmptyStringToNull="true" EmptyDataText="<%$ Resources: Manager, EmptyDataText %>" />
</Columns>
<EditItemStyle CssClass="EditedItem" />
<EditFormSettings UserControlName="~/Courses/Template/CourseCredit.ascx" EditFormType="WebUserControl">
<FormStyle BackColor="White" />
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<Columns>
<%--<telerik:GridClientSelectColumn UniqueName="ClientSelectList" ></telerik:GridClientSelectColumn>--%>
<%--<telerik:GridBoundColumn UniqueName="EnrollListID" HeaderText="Enroll List ID" DataField="listid"></telerik:GridBoundColumn>--%>
<%--<telerik:GridEditCommandColumn UniqueName="ViewListItems" EditText="View List Items" ></telerik:GridEditCommandColumn>--%>
<telerik:GridBoundColumn UniqueName="EnrollListName" HeaderText="Enroll List Name" DataField="listname"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
<%--<ClientEvents OnRowSelecting="EnrollListGrid_OnRowSelecting" />--%>
</ClientSettings>
</telerik:RadGrid>
Please let me know if u need the code behind
Try to ajaxify the source of the binding (i think it's the filtered grid) to the destination of the binding (the second grid).
<telerik:AjaxSetting AjaxControlID="EnrollmentGrid">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="EnrollListGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
Let me know if it help. Otherwise i really need a simpler working version of your code...

Get all radcombobox client id dynamically

In Telerik Control, how to get a radcombobox id?
For example, the below code gets the value of RadCombox1 Client ID. If there is 5 radcomboboxes in my page (sample.aspx), how to get the corresponding id DYNAMICALLY.........
{
var combo = $find("<%= RadComboBox1.ClientID %>");
}
Thanks in Advance,
Ganesan A
Added More :
Thanks for your quick reply. Am using Telerik Control in c#.
a) am using no of radcombobox, raddatepicker, radtimepicker and raddatetimpicker in one page like below
<telerik:RadSplitter ID="RadSplitter1" runat="server" OnClientLoaded="OnClientLoaded">
<telerik:RadPane ID="RadPane1" runat="server">
<telerik:RadComboBox ID="RadComboBox1" CssClass="cmb_bx" runat="server">
<Items>
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem5" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
<telerik:RadComboBox ID="ComboBox" CssClass="cmb_bx" runat="server">
<Items>
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem4" />
<telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem5" />
</Items>
<CollapseAnimation Duration="200" Type="OutQuint" />
</telerik:RadComboBox>
<telerik:RadDatePicker ID="RadDatePicker1" runat="server">
</telerik:RadDatePicker>
<telerik:RadDatePicker ID="SupplierName" runat="server">
</telerik:RadDatePicker>
<telerik:RadDatePicker ID="CorporateCode" runat="server">
</telerik:RadDatePicker>
<telerik:RadDatePicker ID="PartNo" runat="server">
</telerik:RadDatePicker>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</telerik:RadPane>
<telerik:RadPane ID="RadPane2" runat="server">
</telerik:RadPane>
</telerik:RadSplitter>
b) when i scroll the page, radcombobox or any other control which i had mentioned above also scrolling with the page. it doesn't hide. So i am using the below javascript coding
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function OnClientLoaded(sender, eventArgs)
{
var pane = sender.getPaneById("<%= RadPane1.ClientID %>");
var contentElement = pane.getContentElement();
contentElement.onscroll = function () {
var combo = $find("<%= RadComboBox1.ClientID %>");
alert(combo.get_id());
var dtpkr = $find("<%= RadDatePicker1.ClientID %>");
var dropDown = combo.get_dropDownVisible();
var dropDown1 = dtpkr.isPopupVisible();
if (dropDown) {
combo.hideDropDown();
}
else if (dropDown1) {
dtpkr.togglePopup();
}
};
}
</script>
</telerik:RadCodeBlock>
c) This will hide RadcomboBox1 and RadDatePicker1 only. How can i write the code for more than one Radcombobox and Raddatepicker in one page.
Thanks
Ganesan A
You should specify what language, but this might help. This is for C#.
for (int i = 1; i < 6; i++)
{
string comboBoxName = "RadComboBox" + i.ToString();
var comboObject = (this.FindName(comboBoxName) as RadComboBox); //this returns the object if the name is found
//access the clientID
if( comboObject != null)
var clientid = comboObject.ClientID;
}
Since you already know what to do with the RadComboBoxes and RadDatePickers once you have them, I'll simply point out how to grab all the RadControls of a particular type and let you augment your code.

Cannot get initial-scale to work for windows phone 7

I have a webbrowser in my winphone 7 app to display a few webpages that contains 2 buttons left and right with a title in the middle, below that a gridview and a few pictures below the gridview.
I tried just about every combination of the following:
<!--meta name="viewport" content="target-densitydpi=device-dpi; width=device-width; initial-scale=0.35; user-scalable=yes" /-->
<!--meta name="mobileoptimized" content="0" /-->
<!--meta name="viewport" content="width=480; initial-scale=5.0; user-scalable=yes;" id="ViewPort" runat="server" />
<!--meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" /-->
<!--meta name="HandheldFriendly" content="true" /-->
<!--meta name="apple-mobile-web-app-capable" content="yes" /-->
If I use device-width the last few columns in my gridview is off screen, trying to scale it properly with initial-scale does nothing.
If I use a set width, for instance 320 or 640, the gridview becomes to small (smaller then the width of the screen), and initial-scale again does nothing.
Any idea's ?
aspx source added :
<%# Page Language="C#" AutoEventWireup="true" CodeFile="iDetailled.aspx.cs" Inherits="iDetailled" Title="test" EnableEventValidation="false" %>
<%# Register assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<!--meta name="viewport" content="target-densitydpi=device-dpi; width=device-width; initial-scale=0.35; user-scalable=yes" /-->
<!--meta name="mobileoptimized" content="0" /-->
<meta name="viewport" content="width=device-width, initial-scale=0.9,user-scalable=yes" id="ViewPort" runat="server" />
<!--meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8" /-->
<!--meta name="HandheldFriendly" content="true" /-->
<!--meta name="apple-mobile-web-app-capable" content="yes" /-->
<title></title>
<script type="text/javascript">
function CallMe() { javascript: history.go(-1); }
</script>
</head>
<link rel="stylesheet" type="text/css" href="stylesheet.css"
media="screen"/>
<body class="GradientBackground3" bgcolor="#CFD1D2">
<form id="form1" runat="server" >
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableHistory="True"
onnavigate="ScriptManager1_Navigate">
</asp:ScriptManager>
<div align="center">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:MultiView ID="MultiView1" runat="server"
onactiveviewchanged="MultiView1_ActiveViewChanged" >
<asp:View ID="View1" runat="server">
<br />
<asp:Panel ID="Panel2" runat="server" Width="90%" >
<table align="center" width="100%">
<tr>
<td align="left" >
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Images/min2.png" Height="48px" onclick="ImageButton1_Click"
Width="48px" />
</td>
<td>
<table align="center" >
<tr align="center">
<td>
<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Size="Large" Text="Turnover by day"></asp:Label>
</td>
</tr>
<tr align="center">
<td>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</td>
<td align="right">
<asp:ImageButton ID="ImageButton2" runat="server" Height="48px"
ImageUrl="~/Images/plus2.png" onclick="ImageButton2_Click" Width="48px" />
</td>
</tr>
</table>
</asp:Panel>
<br />
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="SqlDataSourceDag" ForeColor="#333333"
GridLines="Vertical" onrowcreated="GridView2_RowCreated"
onselectedindexchanged="GridView2_SelectedIndexChanged"
onrowdatabound="GridView2_RowDataBound"
EmptyDataText="No data to display" >
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="TYBusinessDate" DataFormatString="{0:dd/MM}"
HeaderText="This Year" ReadOnly="True"
SortExpression="TYBusinessDate">
<HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
</asp:BoundField>
<asp:BoundField DataField="LYBusinessDate" DataFormatString="{0:dd/MM}"
HeaderText="Last Year" ReadOnly="True"
SortExpression="LYBusinessDate">
<HeaderStyle VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
</asp:BoundField>
<asp:BoundField DataField="Day" HeaderText="Day" ReadOnly="True"
SortExpression="Day">
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:BoundField DataField="TYTurnoverAmt" DataFormatString="{0:F0}"
HeaderText="This Year" ReadOnly="True" SortExpression="TYTurnoverAmt">
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="LYTurnoverAmt" DataFormatString="{0:F0}"
HeaderText="Last Year" ReadOnly="True" SortExpression="LYTurnoverAmt">
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:TemplateField HeaderText="%">
<ItemTemplate>
<asp:Label ID="Label55" runat="server" Text="Label"></asp:Label>
</ItemTemplate>
<HeaderStyle VerticalAlign="Bottom" HorizontalAlign="Right" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:BoundField DataField="TYClients" HeaderText="This Year" ReadOnly="True"
SortExpression="TYClients" >
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="LYClients" HeaderText="Last Year" ReadOnly="True"
SortExpression="LYClients" >
<HeaderStyle HorizontalAlign="Right" VerticalAlign="Bottom" BorderColor="White" BorderStyle="Solid"
BorderWidth="1px"/>
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/Images/arrow.png"
onclick="ImageButton5_Click" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<br />
<asp:Chart ID="Chart2" runat="server" DataSourceID="SqlDataSourceDag" BackColor="#CFD1D2" >
<Titles>
<asp:Title Name="Title1" Text="Turnover">
</asp:Title>
</Titles>
<series>
<asp:Series Name="ThisYear" XValueMember="Day" YValueMembers="TYTurnoverAmt" LegendText="Turnover this year">
</asp:Series>
<asp:Series Name="LastYear" XValueMember="Day" YValueMembers="LYTurnoverAmt" LegendText="Turnover last year">
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" Area3DStyle-Enable3D="true" Area3DStyle-IsClustered="true" BackColor="White" >
<AxisY IntervalAutoMode="VariableCount" IntervalType="Number" IntervalOffsetType="Number">
</AxisY>
<Area3DStyle Enable3D="True" IsClustered="True" />
</asp:ChartArea>
</chartareas>
<Legends>
<asp:Legend Docking="Bottom" Name="Legend1" BackColor="#CFD1D2" >
</asp:Legend>
</Legends>
</asp:Chart>
<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSourceDag" BackColor="#CFD1D2">
<Titles>
<asp:Title Name="Title1" Text="Clients">
</asp:Title>
</Titles>
<series>
<asp:Series ChartType="Line" Legend="Legend1"
Name="ClientTY" XValueMember="Day" YValueMembers="TYClients" BorderWidth="3" LegendText="Clients this year">
</asp:Series>
<asp:Series ChartType="Line" Legend="Legend1"
Name="ClientLY" XValueMember="Day" YValueMembers="LYClients" BorderWidth="3" LegendText="Clients last year">
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" >
<AxisY IntervalAutoMode="VariableCount" IntervalType="Number" IntervalOffsetType="Number">
</AxisY>
<AxisX IsLabelAutoFit="False">
<LabelStyle Angle="-90" />
</AxisX>
</asp:ChartArea>
</chartareas>
<Legends>
<asp:Legend Docking="Bottom" Name="Legend1" BackColor="#CFD1D2">
</asp:Legend>
</Legends>
</asp:Chart>
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Back"
Visible="False" />
<br />
<asp:SqlDataSource ID="SqlDataSourceDag" runat="server"
ConnectionString="<%$ ConnectionStrings:OSCConnectionString %>"
SelectCommand="WWWiPhoneAllStoresPerDay" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
</asp:View>
....second view stripped
</asp:MultiView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
The attributes initial-scale, minimum-scale, and maximum-scale are unsupported in WP7. For now, you can only use height, width, and user-scalable. I've found that the blog post Matt linked to has some incorrect/misleading info. See the following for more accurate information: http://msdn.microsoft.com/en-us/library/ff462082%28VS.92%29.aspx
Also, from what I've seen, WP7 needs the separators between attributes to be commas, not semi-colons.
Without being able to see the page you're trying to display it's hard to say for sure but it sounds like you may have something else on the page affecting the display of the grid.
For reference, the viewport options are documented at http://blogs.msdn.com/b/iemobile/archive/2010/11/22/the-ie-mobile-viewport-on-windows-phone-7.aspx
I found the most suitable viewport for mobile windows 7 is:
<meta id="viewport" name="viewport" content="width=${wurfl.getProperty('max_image_width')}; initial-scale=1.0; maximum-scale=1.0"/>

Resources