How to select a value from a child form and send it to parent form
page1.aspx <asp:TextBox id='txtSelect' style='Z-INDEX: 101; LEFT: 186px; POSITION: absolute; TOP: 19px' runat='server'></asp:TextBox> <a href='javascript:my_window = window.open(’page2.aspx?formname=Form1.txtSelect’ , ’my_window’,’width=300,height=300’); my_window.focus()'> Select CategoryName</a> page2.aspx <asp:DropDownList id='DropDownList1' style='Z-INDEX: 101; LEFT: 180px; POSITION: absolute; TOP: 66px' runat='server' AutoPostBack='True'> <asp:Label id='Label1' style='Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 66px' runat='server'>Select Category Name <asp:Literal id='Literal1' runat='server'> VB.NET Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ’Put user code to initialize the page here If Not Page.IsPostBack Then ’Fill DataSet .... DropDownList1.DataSource = ds.Tables(0) DropDownList1.DataTextField = 'CategoryName' DropDownList1.DataValueField = 'CategoryId' DropDownList1.DataBind() End If End Sub Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged Try Dim strjscript As String = '<script language=''javascript''>' strjscript = strjscript & 'window.opener.' & HttpContext.Current.Request.QueryString('formname') & '.value = ’' & DropDownList1.SelectedItem.Text & '’;window.close();' strjscript = strjscript & '</script>' Literal1.Text = strjscript Catch ex As Exception Response.Write(ex.Message) End Try End Sub C# private void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (!Page.IsPostBack ) { //Fill DataSet DropDownList1.DataSource = ds.Tables[0]; DropDownList1.DataTextField = 'CategoryName'; DropDownList1.DataValueField = 'CategoryId'; DropDownList1.DataBind(); } } private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) { try { string strjscript = @'<script language=''javascript''>'; strjscript = strjscript + 'window.opener.' + HttpContext.Current.Request.QueryString['formname'].ToString () + '.value = ’' + DropDownList1.SelectedItem.Text + '’;window.close();'; strjscript = strjscript + '</script>'; Literal1.Text = strjscript; } catch(Exception ex) { Response.Write (ex.Message ); } }
How do I load a Window from a XAML file dynamically?
You can load a xaml file dynamically as follows: [C#] // This file should then be next to the exe. If not specify a relative path. FileStream xamlFile = new FileStream('ChartWindow.xaml', FileMode.Open, FileAccess.Read); Window win = XamlReader.Load(xamlFile) as Window; win.Show(); Note that any code-behind associated with the above xaml will not be loaded/processed. In case, you have an assembly reference to a custom dll in the above xaml file, you should reference that assembly with a fully qualified namespace as follows: [XAML] xmlns:syncfusion='clr-namespace:Syncfusion.Windows.Chart;assembly=Syncfusion.Chart.WPF,Version=6.303.0.6,Culture=neutral,PublicKeyToken=3d67ed1f87d44c89' The above assembly should then be present in the GAC for the runtime to find it.
Why does the selection stay grayed out after I change the selection in the ListBox in the click of a button?
This is because the ListBox still doesn’t have the focus. To force focus on the listbox, call it’s Focus method after changing selection on it as follows: this.myListBox.Focus();
How do I get a X in my tabs to allow the user to close certain tabs, as in IE?
This Code Project article provides you such an implementation: An Extended WPF TabControl
How do I get a custom defined permission set of an XBAP application ?
By selecting Custom as the ’Zone’ in the Security tab of the project properties. Permission can be included by clicking on the included column of the corresponding permission.