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.
Currently I have a page with a button on it. When the button is clicked a query string is passed to generic handler. The purpose of this handler is to generate letters for individual students that were in a class (the query string is the class id). As the files are generated they are added to a zip file so the user only has to download one file. Everything works perfectly fine including the downloading of the file.
However my problem is I need a way to know when the handler has finished and to retrieve data from it. Specifically, as the handler is looping through all the students it may find that some students do not have all the necessary data saved in the database in order to generate the appropriate letter. In this case the students name is save in a List(Of String) so that it can inform the user, but continues creating the rest of the letters.
I have tried using HttpContext.Current.Items.Add("BlankStudents", BlankStudentRecords) and HttpContext.Current.Session("BlankStudents") = BlankStudentRecords in order to save the list. The latter did not work because it says the object is not set to an instance and I'm assuming it is referring to the session. The former did work, however the ASP page that calls the handler does not post back so it can't try and read from the HttpContext.
I tried using a redirect but I get a "Cannot redirect after HTTP headers have been sent" because this redirect is being done after the zip file is transmitted to the client. What would be the best way to accomplish this? Would it be better to add the zip file and the List(Of String) both to the HttpContext.Current.Items and then redirect back to the page and initiate the download from there, or is there an even better and efficient method.