So you are assiging your private variables from ViewState each time the page is loaded? Why? Are the values set on the page anywhere? They will always be empty strings if not. If they are preset values there is no reason to use ViewState to store them. Do you understand what ViewState is any how to use it?
cmdSearchCustomer = "select " + search_listbox_value_field + " ," + select_what + " from " + select_from_database + " where " + search_text + " like '" + txrsearch.Text + "%' And "+condition_name+"='"+matching_condition+"' ORDER BY " + select_what + " ASC";
Concatentating strings to form a SQL statement with unvalidated user input? WTF!?! Every heard of a SQL Injection Attack? Every heard of a parameterized query?
Each instance of the control placed on the page is sharing the smae ViewState and Session variables. If there can be multiple instances of the same control you need to take that in to account.
Your classes should be designed in such a way that they can be unit tested without the actual involvement of UI elements. For example, in your case, a method should take an argument that is a flag to indicate which radio button was clicked. You can then apply text fixtures to this method and call it with different arguments to simulate selection of different radio buttons. To put it in another way, your code should not contain hard-coded logic that works differently for different selections of UI elements. It you write code that way, it is very difficult to unit test them.
I have an asp:menu with a css background-image on the StaticMenuItemStyle-CssClass. But, the background around the text label itself isn't opaque, so there's a solid blue box around the text that you can clearly see over the background image (see my screenshot). How do I make the text label background transparent?
For that, you have to do the following.....
1) First retrieve the max id from your database.
2) Then convert the number part of data i.e. 00000001 to int.
3) Then increment it.
4) According to the number, concatenate that number of 0's and V to the incremented number.
5) Insert this id to your database.
I want to validate textbox only if checkbox is unchecked, if checkbox is checked no need to validate textbox as require field.
At where and when I have to attach and deattach RequireFieldValidator to textbox?
return Page_Validate("VALIDATION GROUP NAME");
I added a CustomValidator to the textbox and add ClientValidationFunction
This is my solution to share with other people those who have problem as mine
<asp:CustomValidatorID="CustomValidator1"runat="server"ClientValidationFunction="CheckPorts"ControlToValidate="txtPort"ErrorMessage="Please checked at checkbox or enter Port code in textbox."ValidateEmptyText="True"ValidationGroup="RegisterAgentUser">*</asp:CustomValidator>
ValidateEmptyText="True" also important here, if not control will not doing validation.