Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Search the Tips
Tip Bank > Web Development > Web Controls

Web Controls - Page 4

61-80 of 352     Previous     Next
by Marco Bellinaso
Have you ever tried to change the BorderStyle, HideSelection, MultiLine, ScrollBars, WordWrap and TextAlign properties of a TextBox, or the ComboBox
FindControl - Retrieving a reference to the control with the specified name
by Marco Bellinaso
Return a reference to the control with the specified name, searched into the specified container and its sub-controls Note: it requires the GetAllControls function Example: get a reference to a Label named "lblTest", and set its Text property DirectCast(FindControl("lblTest", Me), Label).
InputBox - A .NET replacement for this VB6 function
by Marco Bellinaso
Create an InputBox like the one of VB6. You can define the dialog's title, question and default value. Example: MessageBox.Show(InputDialog.InputBox("Type your name:", "Test", "Marco"))
InsertImageIntoRtb - Inserting an image into a RichTextBox
by Marco Bellinaso
Insert an image into a RichTextBox, in the current position This version takes in input the target RichTextBox and the path of the image to insert Example: InsertImageIntoRtb(RichTextBox1, "C:\test.jpg")
Skipping columns when tabbing on a DataGrid
by Marco Bellinaso
It happens quite often that you have a DataGrid with hidden columns (with width = 0), because you need their values but don't want to show them to the user. However, when you tab through the DataGrid's columns, these "hidden" columns are still taken into account in the tab order. This means ...
Associating a custom bitmap to a web or Windows custom control
by Marco Bellinaso
When you create a custom Windows or Web control, compile it and add it to the Visual Studio .NET's Toolbox, the control is added to the toolbox with a default bitmap representing a gear. This might be fine if you're developing the controls for your own use, but it surely isn't what you want if ...
Creating a scrollable DataGrid
by Marco Bellinaso
When you create a DataGrid, it would be often good to specify its height, and have the DataGrid show a scrollbar if the content is longer than the given height. This would allow to make up a fixed layout that doesn't get messed up if there are a few or a lot of lines/records to show. The ...
GetAllControls - Retrieving all the controls inside a container and its sub-containers
by Marco Bellinaso
Returns an array with all the controls in the specified container control and its child containers Example: print the name of all the controls on the form and its child container controls Dim ctl As Control For Each ctl In GetAllControls(Me) Debug.WriteLine(ctl.Name) Next
GetValidationSummary - Builds a validation summary for all the controls inside a container
by Marco Bellinaso
Return a validation summary string with all the error messages, if any, of the controls inside the specified container, associated to an ErrorProvider control Example: Dim summary As String = "" display the validation summary for all the controls on the form summary = GetValid
Add Controls to a Project Quickly
by Darin Higgins
GetControlsByType - Retrieving an array of controls of the specified type
by Marco Bellinaso
Returns an array of controls of the specified type, found within the specified parent control (or the form itself). Note: the search is optionally done recursively, by checking also controls' child controls Example: get an array with the form's textboxes Dim textboxes() As TextBox = ...
ResetControls - Reset the value for the input array of controls
by Marco Bellinaso
Resets the value for the input array of controls, and thier child controls Example: - reset all the controls on the form: ResetControls(Me) - reset specific controls: ResetControls(TextBox1, CheckBox1, GroupBox1)
CountCheckedNodes - Retrieving the number of checked nodes in a treeview
by Marco Bellinaso
Return the number of checked nodes in the specified tree
Adding a confirmation popup for delete buttons defined within templates
by Marco Bellinaso
The DataList and DataGrid controls easily allow to add a "Delete" button/hyperlink in your template. When clicked, this button/link raises a DeleteCommand event that you can handle to delete the data item of the parent DataList's/DataGrid's row. Here's an example that shows how to ...
Creating DataGrid's hyperlink columns with multiple parameters in the Url
by Marco Bellinaso
The DataGrid's HyperLinkColumn column is great to have a column with an hyperlink that points to an Url with a parameter whose value is taken from the data source, but what if you need to build the target Url with more than one parameter taken from the data source? In this case you can use a ...
Hiding controls defined within templates to some users
by Marco Bellinaso
It happens frequently that you want to hide some input controls or links if the current user is not logged in (it runs with the anonymous account), or if the logged user is not a member of a specific group. For example, you may want to hide the Edit/Delete buttons to users that are not ...
Implementing a two-way sorting for the DataGrid control
by Marco Bellinaso
DataGrid's sorting functionality is not automatic, the control takes care of "just" rendering the column headers as hyperlinks, and gives you the ability to handle the click on those links, by means of the SortCommand event. Then you manually sort the records (by means of a new DataView ...
Showing a graphical checkmark on DataGrid's boolean columns
by Marco Bellinaso
While working with template-based controls such as the Repeater, DataList or DataGrid, it often happens that you don't want to show just plain text as it is retrieved from the data source, but want to interpret the data and represent it in other ways. For example, you may want to show a ...
Relative Urls in user controls
by Marco Bellinaso
Urls that you set in user-control's child controls are relative to the user control's directory, not to the host page's directory. Say for example that you have an user-control located under the /UserControls directory, and the host page under the / root directory. The user-control exposes a ...
Accessing user controls from the code-behind
by Marco Bellinaso
When you add a user control to an ASP.NET page, Visual Studio .NET does not add a control declaration as it does when you add standard ASP.NET web controls. The result is that you can't directly access the user control from the code-behind and programmatically change its properties and call its ...
61-80 of 352     Previous     Next
Thanks for your registration, follow us on our social networks to keep up-to-date