internal class MyHeaderTemplate : ITemplate { private readonly RadButton _okButton; public MyHeaderTemplate() { _okButton = new RadButton(); _okButton.ID = "OkButton"; _okButton.Text = "OK"; } internal RadButton ButtonOk { get { return _okButton; } } public void InstantiateIn(Control container) { container.Controls.Add(_okButton); } }
public void DefineGridStructure() { var templateColumn = new GridTemplateColumn(); templateColumn.UniqueName = "myColumn" + i; templateColumn.ItemTemplate = new RoleColumn("myColumn" + i); // add the dynamically created columns to the grid dgLoginRequest.MasterTableView.Columns.AddAt(COLUMN_START_POS - 1, templateColumn); } public class RoleColumn : ITemplate
{ protected CheckBox roleCheckbox; private string _columnName; public RoleColumn(string columnName) { _columnName = columnName; } public void InstantiateIn(Control container) { roleCheckbox = new CheckBox { ID = "cbx" + _columnName }; roleCheckbox.AutoPostBack = true; roleCheckbox.DataBinding += new EventHandler(roleCheckbox_DataBinding); container.Controls.Add(roleCheckbox); } private void roleCheckbox_DataBinding(object sender, EventArgs e) { var cBox = (CheckBox)sender; var container = (GridDataItem)cBox.NamingContainer; cBox.Checked = ((EntityUserRole)container.DataItem).Roles[0][_columnName]; } } public void BindDataGrid() { try { DefineGridStructure(); dgLoginRequest.DataSource = DataSource; dgLoginRequest.DataBind(); } catch (Exception ex) { throw; } }
public
interface IRole
{
Int16 RoleID { get; set; }
string RoleName { get; set; }
Int16 OrderID { get; set; }
}
protected void dgLoginRequest_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) {
var i = 0; foreach (Role role in Roles) { var checkbox = (e.Item as GridDataItem)["myColumn" + i].Controls[0] as CheckBox; checkbox.CheckedChanged += new EventHandler(cbxReader_CheckedChanged);
i++; } } }An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
|
If I use DataBinding to create my menuitems, and use the OnClientItemClicked event to call a javascript which calls a radwindow (popup), the called radwindow does not popup, rather it loads into the target pane.
(well it pops up briefly, then exits and reloads in the Target Pane)
However, when I Create the MenuItems in HTML, the call to the OnClientItemClicked javascript , does popup the radwindow correctly.
My workaround for this was "AppendDataBoundItems" and retain a menu item from HTML, such that my popup radwindow pops up correctly...Happiness,..BUT
It is AppendDataBoundItems,...and I really want PrePend,..i.e. I would like my MenuItem with Popup to appear at the end of the Menu, not the beginning.
Any help,..ideas ? (for either).
Code is:
RadMenu AdminAuthMenu = this.NavPane.FindControl("RadMenu1") as RadMenu;
AdminAuthMenu.DataSource = SiteMap.GetdbMenuItems(); //Just class with db sql to get MenuItems
AdminAuthMenu.DataBind();
protected void RadMenu1_OnItemDataBound(object sender, RadMenuEventArgs e)
{
RadMenuItem ei = e.Item as RadMenuItem;
ei.Target = "ContentPane";
}Markup is:
telerik:RadMenu ID="RadMenu1" runat="server" Width="100%" Height="31px" Skin="Black"
OnClientItemClicked="MenuItemItemClicked"
DataFieldID="ScreenId"
DataNavigateUrlField="Screen"
DataTextField="Title"
DataValueField="ScreenId"
OnItemDataBound="RadMenu1_OnItemDataBound"
AppendDataBoundItems="True">
<DefaultGroupSettings Flow="Horizontal" />
<Items >
<telerik:RadMenuItem runat="server" Text="Login" value="Login"
BackColor="Transparent" ForeColor="#FFFFC0"></telerik:RadMenuItem>
</Items>
function verificarCPF() { var contador; var valorCPF = $telerik.findMaskedTextBox("txtBuscaCpf").get_value(); var numeroCPF = valorCPF.substr(0, 9); var digitoCPF = valorCPF.substr(9, 2); var d1 = 0; for (contador = 0; contador < 9; contador++) { d1 += numeroCPF.charAt(contador) * (10 - contador); } if (d1 == 0) { radalert("CPF Inválido!",350,140,"Mensagem",null,null); return false; } d1 = 11 - (d1 % 11); if (d1 > 9) d1 = 0; if (digitoCPF.charAt(0) != d1) { radalert("CPF Inválido!", 350, 140, "Mensagem", null, null); return false; } d1 *= 2; for (contador = 0; contador < 9; contador++) { d1 += numeroCPF.charAt(contador) * (11 - contador); } d1 = 11 - (d1 % 11); if (d1 > 9) d1 = 0; if (digitoCPF.charAt(1) != d1) { radalert("CPF Inválido!", 350, 140, "Mensagem", null, null); return false; } return true; //radalert("CPF Válido!", 350, 140, "Mensagem", null, null);}<telerik:RadMaskedTextBox ID="txtBuscaCpf" ClientEvents-OnBlur="verificarCPF" AutoPostBack="true" runat="server" Mask="###.###.###-##" Width="100" OnTextChanged="txtBuscaCpf_TextChanged" />