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.