How to open a new window with multiple parameters when clicked on a hyperlink in a column in a datagrid
The column should be defined as a TemplateColumn as follows and the NavigateUrl for that hyperlink can be set as follows to open a new window with parameters varying based on the row in which the hyperlink is present. <asp:TemplateColumn > <ItemTemplate> <asp:Hyperlink ID=’Hyperlink2′ Runat=’Server’ NavigateUrl= <%#’javascript:my_window=window.open(’webform2.aspx?id=’ + DataBinder.Eval(Container.DataItem,’productid’).ToString() + ‘&Supplierid=’ + DataBinder.Eval(Container.DataItem,’SupplierID’).ToString() + ‘’,’my_window’,’width=300,height=300’);my_window.focus()’ %> text=<%#DataBinder.Eval(Container.DataItem,’ProductName’).ToString() %>> </asp:Hyperlink> </ItemTemplate> </asp:TemplateColumn> The above approach would avoid the problem of showing the screen of [Object] on the parent page
Why do I get error message ‘The control ‘_ctl1’ of type ‘TextBox’ must be inside a form label with runat=server’ while trying to place a control inside a form dynamically
You are probably adding the textbox into the Page directly instead of adding it to the Page’s form. Try doing this: VB.NET Me.Page.Controls(1).Controls.Add(txtboxctrl) C# this.Page.Controls[1].Controls.Add(txtboxctrl);
What is the difference between User Controls and Custom Controls?
User Controls are text files with the extension ’.ascx’ which enables you to make GUI re-usable controls. Its a text file, which contains a mixture of HTML and scripting. User Controls can be edited in an editor. On the other hand Custom Controls reside in compiled ( Dll ) assemblies. They are non-GUI but can emit HTML GUI at runtime. Example of Custom Controls would be the sever controls which come bundled with the .NET SDK like DataGrid, Repeater, DataList etc. Custom Controls are always compiled into Dll’s and hence require good programming knowledge. The purpose of Custom Controls is also to create re-usable units of code.
How to maintain Scroll Position in any Page Element
Check out Jim Ross’s article Maintain Scroll Position in any Page Element The article describes, when using a scrollable Datagrid–one inside an overflow-auto DIV control–how to maintain the user’s scroll position inside the DIV across postbacks. It does this using IE behaviors, HTC files.
How to create server controls at runtime
Here is an example of creating a HyperLink control in code. VB.NET Dim hpl As New HyperLink() hpl.Text=’Text’ hpl.NavigateUrl=’http://www.syncfusion.com’’ hpl.ID=’theID’ Page.Controls(1).Controls.Add(hpl) C# HyperLink hpl = new HyperLink(); hpl.Text=’Text’; hpl.NavigateUrl=’http://www.syncfusion.com’; hpl.ID=’theID’; Page.Controls[1].Controls.Add(hpl);