To filter the datatable based on the distinct value of a column, use the below code
dataSet.Tables(0).DefaultView.ToTable(true,"ColumnName") ;
or dataTable.DefaultView.ToTable(true,"ColumnName") ;
where ColumnName is the name of the column whose distinct value is to be found.
Tuesday, March 2, 2010
Saturday, February 13, 2010
Accept Button in WPF
How do we achieve the accept button and cancel button in WPF?
We just have to set the button attributes for enable those features.
Accept Button - Button.IsDefault = "True"
Cancel Button - Button.IsCancel = "True"
We just have to set the button attributes for enable those features.
Accept Button - Button.IsDefault = "True"
Cancel Button - Button.IsCancel = "True"
Wednesday, October 14, 2009
Show hidden files option not getting retained
Why is "Show hidden files" option not getting retained?
This is because, the update is not getting saved in registry because of the effect of virus. This can be fixed easily by following the steps below.
This is because, the update is not getting saved in registry because of the effect of virus. This can be fixed easily by following the steps below.
- Type regedit in Run command
- Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL
- Delete the entry CheckedValue in the right pane by right clicking on the entry and click delete.
- Create a new DWORD value entry by right clicking and clicking New-> DWORD value
- Change the name of new dword to CheckedValue
- Right click on the CheckedValue entry, hit modify and change value to 1. Hit OK.
- Thats all. The problem is solved.
Double click not working on drives.
This problem is because of the effect of virus which is very easy to fix. A file named autorun.inf might be created in the root directory of each drives. Deleting those files will fix the problem. Follow the steps below.
- Type cmd in Run window.
- If the drive is not C, type C: in command prompt
- Type cd\ to move to the root directory
- Type "attrib -r -h -s autorun.inf"
- Type "del autorun.inf"
- Move to next drive by typing D:
- Repeat the above steps(4 to 6) for all the drives.
- Restart the system.
Saturday, October 10, 2009
The changed values of a read only or disabled text box is not retained after postback
Scenario : The changed values of a read only or disabled text box is not retained after postback.
Reason : Browser is not maintaining the state of a read only or disabled control.
Solution: The values of all the form controls are maintained inside Request.Form. So include the following code snippet inside page load to retain the values dynamically in the textbox.
Inside Page_Load
if(IsPostBack)
TextBox1.Text = Request.Form(this.TextBox1.ClientID);
Reason : Browser is not maintaining the state of a read only or disabled control.
Solution: The values of all the form controls are maintained inside Request.Form. So include the following code snippet inside page load to retain the values dynamically in the textbox.
Inside Page_Load
if(IsPostBack)
TextBox1.Text = Request.Form(this.TextBox1.ClientID);
Removing Yahoo Messenger from StartUp
For removing any item from start up, the normal practice is to remove the item from startup option in msconfig. For that do the following steps.
- Type msconfig in run command. (Admin privilege is required)
- In the configuration window that is popped up, select the startup tab.
- Uncheck the applications you want to remove from start up.
- Click Ok.
- From the next reboot onwards, the application wont start on startup.
- Login to Yahoo Messenger.
- Select Messenger Menu Item.
- Select Preferences.
- Select General Category.
- Uncheck automatically start yahoo messenger option.
- Click OK.
Yahoo Messenger Preferences
If both these approaches are not working, follow the third and final approach. This is by removing the entry from registry as explained below.
- Stop yahoo if already running. Thia can be done by right click yahoo icon in taskbar and click exit.
- Take registry editor. This can be done by typing regedit in Run command.
- Navigate to the node "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
- Delete the entry Yahoo! Pager. (It is advisable to keep a back up of the registry entry before making any changes. This can be done by right clicking on Run Node and select export)
- Restart system.
Thursday, October 8, 2009
Clearing an ajax combobox in ASP.Net
An ajax combo-box coming with 3.5 framework is not working the expected way when it comes in rebinding the combo-box and clearing the selection value. The normal combo-box.ClearSelection() wont work in this case. It is because the combo-box selection value is saved inside a hidden control which is not getting cleared. The above problem can be solved by including the following code snippet.
combobox1.ClearSelection();
foreach (Control control in combobox1.Controls)
{
if (control is HiddenField)
((HiddenField)control).Value = "0"; //Where 0 is the value associated with the first selection item.
}
combobox1.ClearSelection();
foreach (Control control in combobox1.Controls)
{
if (control is HiddenField)
((HiddenField)control).Value = "0"; //Where 0 is the value associated with the first selection item.
}
Subscribe to:
Posts (Atom)