<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!
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">
<title></title>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
</telerik:RadStyleSheetManager>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Windows7">
</telerik:RadSkinManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadTextBox1" />
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadTextBox ID="RadTextBox1" runat="server">
</telerik:RadTextBox>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
<telerik:RadGrid
ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
onneeddatasource="RadGrid1_NeedDataSource" Visible="False"
onitemdatabound="RadGrid1_ItemDataBound" AllowSorting="True">
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridTemplateColumn Visible="False">
<ItemTemplate>
<asp:Label ID="lblHiddenHotelID" runat="server" Text='<%# Eval("pkHotelID") %>' style="display:none"></asp:Label>
<asp:Label ID="lblHiddenObsolete" runat="server" Text='<%# Eval("Obsolete") %>' style="display:none"></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Hotel" SortExpression="HotelName">
<ItemTemplate>
<asp:Label ID="lblHotelName" runat="server" Text='<%# Eval("HotelName") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Obsolete">
<ItemTemplate>
<asp:CheckBox ID="chkObsolete" runat="server"></asp:CheckBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Rating">
<ItemTemplate>
<telerik:RadRating ID="RadRatingHotel" runat="server" ItemCount="5" Precision="Item"
Value='<%# Convert.ToDouble(Eval("Rating")) %>'>
</telerik:RadRating>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</div>
</form>
</
body>
</
html>
using
System;
using
System.Collections.Generic;
using System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
using
System.Data.SqlClient;
using
Telerik.Web.UI;
public
partial class _Default : System.Web.UI.Page
{
#region
Properties
string connString = System.Configuration.ConfigurationManager.ConnectionStrings["EventMgmtCS"].ToString();
#endregion
#region
DataTables
DataTable HotelSearchResults
{
get
{
SqlParameterCollection sqlParams = new SqlCommand().Parameters;
sqlParams.Add(
Napp_SQLServer.BuildSQLCommandParamater("@search_type", "Hotel Name", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input));
sqlParams.Add(
Napp_SQLServer.BuildSQLCommandParamater("@hotel_name", RadTextBox1.Text, System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input));
DataTable dt = Napp_SQLServer.BuildDataTableWithParameters(connString, "proc_hotel_search", sqlParams);
return dt;
}
}
#endregion
#region
Events
protected void Button1_Click(object sender, EventArgs e)
{
RadGrid1.Visible =
true;
RadGrid1.Rebind();
}
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGrid1.DataSource = HotelSearchResults;
}
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item | e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem | e.Item.ItemType == Telerik.Web.UI.GridItemType.EditItem | e.Item.ItemType == Telerik.Web.UI.GridItemType.SelectedItem)
{
//declare all the items in the grid
Label lblHiddenObsolete = (Label)e.Item.FindControl("lblHiddenObsolete");
CheckBox chkObsolete = (CheckBox)e.Item.FindControl("chkObsolete");
if (lblHiddenObsolete.Text == "True")
{
chkObsolete.Checked =
true;
}
else
{
chkObsolete.Checked =
false;
}
}
}
#endregion
}
I'm using a radtabstrip and radmultipage to move a user through a complex form and get payment at end (using sagepay/protx). I tried using Response.Redirect/RadScriptManager.Redirect/RadAjaxPanel.redirect - also IFRAME and RadWindows but none of these approaches worked because of potential security issues.
The fix was wrapping this line of code within the server side event click - and then double-clicking on the button to execute javascript.
btnMakePayment.Attributes.Add(
"onClick", string.Format("window.open('{0}', '{1}');return false;", response.NextURL, "winSagepay"));
radwin.open would fail (see a response from teh telerik team), the radwindow uses IFRAME (see another response from telerik team) - and the rest don't work. They did work under some circumstances (in a dev environment) but not when I put the code on a test box.
This is a HACK - I would love to hear how others have approached this problem.
Hi,
I want show below like this. Based on the dates range I want show the events with recurrence events. how to show the events in Radgrid control or any control to show like this.
sample:
From : 5/2/2010 To : 5/15/2010 | show button |
| Name | Start Time | End Time | Subject | Description ( Page Header ) |
|||
-------------------------------------------------------------------------------------------------------------------------------------------
5/2/2010 10pm 11 pm meeting with client discussion abut requirements
5/2/2010 11 pm 1 pm visit doctor remainder
5/4/2010 ( sub heading )
--------------------------------------------------------------------------------------------------------------------------------------------
5/4/2010 8 pm 9 pm meeting with realtor completion on the wall construct
-
-
-
-
-
-
5/6/2010 ( sub heading )
-----------------------------------------------------------------------------------------------------------------------------------------------------
-
-
-
-
-
I wanted a RadNumericTextBox and a RadDateTimePicker to be loaded hidden, but later be made visible via javascript. Perhaps the most elegant solution is to use AJAX, but in my case I want the hide and unhide to always happen instantly, so javascript is the best choice. I found a work around for both, but it's ugly. Perhaps I overlooked something. Perhaps a future release can handle this issue better. Here's my solution.
Initialization
| Protected Overrides Sub CreateChildControls() |
| ... |
| RadDateTimePicker1.Style("display") = "none" |
| ... |
| RadNumericTextBox1.ClientEvents.OnLoad = "function(){$find(""" & RadNumericTextBox1.ClientID & """).set_visible(false);}" |
| ... |
| End Sub |
| var display = function(control, visible) { |
| if (control.style) { //normal |
| control.style.display = visible ? "" : "none"; |
| } |
| else { |
| if (control._numberFormat) { //numeric |
| control.set_visible(visible); |
| } |
| else { //datetime |
| $get(control.get_id() + "_wrapper").style.display = visible ? "inline-block" : "none"; |
| } |
| } |
| } |
The problem is that we can’t set the Page Size greater than the Items Count.
We want to be able to set the page size 10 even if there is 4 items in the source list.
Steps to reproduce: bind to the grid the source with 4 items, try to enter 10 to the Page Size texbox, press Change button.
Actual result: the value of the textbox is turned back to previous value.
Expected result: the page size is changed to 10
The aspx code :
<telerik:RadGrid ID="dgdTransList" runat="server" AutoGenerateColumns="True"
GridLines="None" EnableAJAX="true" PageSize="5" ShowFooter="true"
AllowPaging="true"
>
<PagerStyle
Visible="true"
Mode="NextPrevNumericAndAdvanced"
AlwaysVisible="true"
/>
</telerik:RadGrid>
The cs code :
void dgdTransList_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
ArrayList list = new ArrayList(new object[] { "one", "two", "three", "four" });
dgdTransList.DataSource = list;
}
Can you please tell us is there any workaround?
| <telerik:GridAttachmentColumn UniqueName ="colTPdf" FileNameTextField="ORT.OTCLIE" AttachmentKeyFields="ORT.OTNUOR" Text="Scarica ordine" ImageUrl="~/images/icoGear.png" > |
| </telerik:GridAttachmentColumn> |