All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM Customers"
runat="server"></
>
protected
void
Page_Init(
object
sender, EventArgs e)
{
RadGrid grid =
new
RadGrid();
grid.AutoGenerateColumns =
false
;
grid.DataSourceID =
string
templateColumnName =
"ContactName"
GridTemplateColumn templateColumn =
GridTemplateColumn();
templateColumn.ItemTemplate =
MyTemplate(templateColumnName);
templateColumn.HeaderText = templateColumnName;
GridBoundColumn boundColumn1 =
GridBoundColumn();
boundColumn1.DataField =
boundColumn1.UniqueName =
"ConactName"
boundColumn1.HeaderText =
"Bound Column"
grid.MasterTableView.Columns.Add(templateColumn);
grid.MasterTableView.Columns.Add(boundColumn1);
grid.AllowPaging =
true
grid.PageSize = 3;
grid.Skin =
"Outlook"
PlaceHolder1.Controls.Add(grid);
}
private
class
MyTemplate : ITemplate
LiteralControl lControl;
RequiredFieldValidator validatorTextBox;
HyperLink searchGoogle;
TextBox textBox;
CheckBox boolValue;
colname;
public
MyTemplate(
cName)
colname = cName;
InstantiateIn(System.Web.UI.Control container)
lControl =
LiteralControl();
lControl.ID =
"lControl"
lControl.DataBinding +=
EventHandler(lControl_DataBinding);
textBox =
TextBox();
textBox.ID =
"templateColumnTextBox"
validatorTextBox =
RequiredFieldValidator();
validatorTextBox.ControlToValidate =
validatorTextBox.ErrorMessage =
"*"
searchGoogle =
HyperLink();
searchGoogle.ID =
"searchGoogle"
searchGoogle.DataBinding +=
EventHandler(searchGoogle_DataBinding);
boolValue =
CheckBox();
boolValue.ID =
"boolValue"
boolValue.DataBinding +=
EventHandler(boolValue_DataBinding);
boolValue.Enabled =
Table table =
Table();
TableRow row1 =
TableRow();
TableRow row2 =
TableCell cell11 =
TableCell();
TableCell cell12 =
TableCell cell21 =
TableCell cell22 =
row1.Cells.Add(cell11);
row1.Cells.Add(cell12);
row2.Cells.Add(cell21);
row2.Cells.Add(cell22);
table.Rows.Add(row1);
table.Rows.Add(row2);
cell11.Text = colname +
": "
cell12.Controls.Add(lControl);
cell21.Text =
"Search Google for: "
cell22.Controls.Add(searchGoogle);
container.Controls.Add(textBox);
container.Controls.Add(validatorTextBox);
container.Controls.Add(table);
container.Controls.Add(
LiteralControl(
"<br />"
));
container.Controls.Add(boolValue);
boolValue_DataBinding(
CheckBox cBox = (CheckBox)sender;
GridDataItem container = (GridDataItem)cBox.NamingContainer;
//cBox.Checked = (bool)((DataRowView)container.DataItem)["Bool"];
searchGoogle_DataBinding(
HyperLink link = (HyperLink)sender;
GridDataItem container = (GridDataItem)link.NamingContainer;
link.Text = ((DataRowView)container.DataItem)[colname].ToString();
link.NavigateUrl =
"http://www.google.com/search?hl=en&q="
+ ((DataRowView)container.DataItem)[
].ToString() +
"&btnG=Google+Search"
lControl_DataBinding(
LiteralControl l = (LiteralControl)sender;
GridDataItem container = (GridDataItem)l.NamingContainer;
l.Text = ((DataRowView)container.DataItem)[colname].ToString() +