| using System; |
| using System.Configuration; |
| using System.Data; |
| using System.Linq; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.HtmlControls; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Xml.Linq; |
| using System.Text; |
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| try |
| { |
| this.ClientScript.RegisterStartupScript(this.GetType(), |
| this.Page.ToString(), |
| GeneraScript(string.Format("Sys.Application.add_load(OpenWindowWH1('pruebaPop.aspx', 480, 485));", 1)) |
| ); |
| } |
| catch (Exception ex) |
| { |
| } |
| } |
| public static string GeneraScript(string codigo) |
| { |
| StringBuilder sbScript = new StringBuilder(); |
| sbScript.AppendLine("<script type =\"text/javascript\">"); |
| sbScript.AppendLine("<!--"); |
| sbScript.AppendLine(codigo); |
| sbScript.AppendLine("//-->"); |
| sbScript.AppendLine("</script>"); |
| return sbScript.ToString(); |
| } |
| } |
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
| <%@ Register Assembly="Telerik.Web.UI, Version=2009.2.701.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" |
| 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>Untitled Page</title> |
| <script type="text/javascript" language="javascript"> |
| <!-- |
| function OpenWindowWH1(url, width, heigth) { |
| debugger; |
| var oWindow = GetRadWindow(); |
| if(oWindow) |
| { |
| oWindow.setUrl(url); |
| } |
| else |
| { |
| oWindow = window.radopen(url, 'VentanaFlotanteUsr'); |
| } |
| //var oWindow = window.radopen(url, 'VentanaFlotanteUsr'); |
| oWindow.set_visibleStatusbar(false); |
| oWindow.set_showContentDuringLoad(false); |
| oWindow.setSize(width, heigth); |
| oWindow.center(); |
| oWindow.set_behaviors(4); |
| oWindow.set_modal(true); |
| oWindow.add_close(CierraUsuarios); |
| } |
| //--> |
| </script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <telerik:RadScriptManager ID="rdscrpAdm" runat="server"></telerik:RadScriptManager> |
| <telerik:RadAjaxManager ID="RadAjaxManagerActividades" runat="server"> |
| </telerik:RadAjaxManager> |
| <telerik:RadWindowManager ID="RadWindowManagerUsuarios" runat="server" > |
| <Windows> |
| <telerik:RadWindow ID="VentanaFlotanteUsr" runat="server" Title="Seleccione usuario" Splash="false" VisibleOnPageLoad="false" Visible="true" Height="485px" Width="475px" ReloadOnShow="true" Modal="true" Behavior="Pin,Close" OnClientClose="CierraUsuarios" /> |
| </Windows> |
| </telerik:RadWindowManager> |
| </div> |
| </form> |
| </body> |
| </html> |
Hello i need to create from 1 to many new RadGrids based on the selection of an item/s from a static RadGrid, ie create a new "on the fly" RadGrid for every row item selected from a static RadGrid. I thought that by giving each new RadGrid a new RadGrid.ID, see below, that it might create a new RadGrid and that a new RadGrid would appear under the previously created RadGrids, ie appending new RadGrids under the previous created "otf" RadGrids. But i think i'm getting the understanding that i would need to create all of the potential new "otf" RadGrids in advance and manage the visibiliy of each one as needed. For example i would have to create a list of RadGrids in advance like RadGrid radgrid1; RadGrid radgrid2; RadGrid radgrid3; ......ect. Or is there a way to actually create a new RadGrid really genuinely from scratch on the fly?
private void DefineGridStructure2()
{
string txt = "TABLE1";
CustomQuery.
GetInfoSchema gis = new CustomQuery.GetInfoSchema();
string cs = "Data Source=DEVSQL.fhfb.gov;Initial Catalog=CustomQuery;Integrated Security=True";
DataTable dt = gis.GetTableInfo(cs, txt);
RadGrid grid = new RadGrid();
string sgridID="grid"+lblMessage.Text;
grid.ID = sgridID;
grid.AutoGenerateColumns =
true;
grid.DataSource = dt;
grid.DataBind();
Master.FindControl(
"mainContain").Controls.Add(grid);
string chktxt = lblMessage.Text;
}
<
telerik:RadGrid runat="server" ID="radViews" AutoGenerateDeleteColumn="True"
AutoGenerateEditColumn="True" GridLines="None" AllowAutomaticUpdates="true"
Skin="Office2007" OnItemCommand="radViews_ItemCommand" >
<
HeaderContextMenu EnableTheming="True">
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
HeaderContextMenu>
<
MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top">
<
RowIndicatorColumn>
<
HeaderStyle Width="20px"></HeaderStyle>
</
RowIndicatorColumn>
<
ExpandCollapseColumn>
<
HeaderStyle Width="20px"></HeaderStyle>
</
ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID"
SortExpression="ID" UniqueName="ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Text" HeaderText="Text"
SortExpression="Text" UniqueName="Text">
</telerik:GridBoundColumn>
</Columns>
</
MasterTableView>
<
FilterMenu EnableTheming="True">
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
FilterMenu>
</telerik:RadGrid>
protected
void radViews_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked
{
e.Canceled =
true;
//Prepare an IDictionary with the predefined values
System.Collections.Specialized.
ListDictionary newValues = new System.Collections.Specialized.ListDictionary();
newValues[
"Tag"] = user.UserName;
//Insert the item and rebind
e.Item.OwnerTableView.InsertItem(newValues);
}
// Pass to MVP
if (e.CommandName == RadGrid.DeleteCommandName)
{
this.OnDeleteView(this, e);
}
if (e.CommandName == RadGrid.EditCommandName)
{
"Go Go Gadget editable Grid!!!!"
}
}
| <telerik:RadMenu OnClientMouseOut="Mmouseout" OnClientMouseOver="Mmouseover" OnItemClick="RadMenu1_OnItemClick" |
| OnClientItemClicked="RadMenu1_OnClientItemClicked" ID="RadMenuLine" ExpandAnimation-Type="InOutBack" |
| CollapseAnimation-Type="InQuad" BorderColor="Brown" |
| Skin="WebBlue" runat="server" Font-Size="Small" |
| Width="100%" commandName="MenuCommand" > |
| <Items> |
| <telerik:RadMenuItem GroupSettings-ExpandDirection="Up" runat="server" Text="View" |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" Style="font-weight: bold"> |
| <Items> |
| <telerik:RadMenuItem runat="server" Text="Detail" CssClass="MenuItemLeft" BackColor="Yellow" |
| ForeColor="Blue"> |
| </telerik:RadMenuItem> |
| <telerik:RadMenuItem runat="server" Text="Summary" ForeColor="Blue"> |
| </telerik:RadMenuItem> |
| <telerik:RadMenuItem runat="server" Text="Print" NavigateUrl="~/mybodyscience/MBS_Reports/iqReport_Display.aspx" |
| BackColor="Yellow" ForeColor="Blue" Target="_blank"> |
| </telerik:RadMenuItem> |
| </Items> |
| </telerik:RadMenuItem> |
| <telerik:RadMenuItem runat="server" Text="Add Equipment" commandName="MAddCommand" |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" > |
| </telerik:RadMenuItem> |
| <telerik:RadMenuItem runat="server" Text="Refresh" |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" > |
| </telerik:RadMenuItem> |
| <telerik:RadMenuItem runat="server" id="Mhelp" Text="Help" commandName="MhelpCommand" |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" Value="88"> |
| </telerik:RadMenuItem> |
| </Items> |
| </telerik:RadMenu> |