I have the Problem with the File Upload window. When I used it the first time it works perfect but when I call the same functionality to open and upload a File the open button (in the "Choose File to Upload" Dialog) is pressed to fast. So the Test can not write the complete path of the File over set and so the I can not open the File. The Source Code of the function:
public void OpenFileDialogAndUploadCsvFileWithName(string fileName, IE editPage)
{
var fileUploadDialog = editPage.HtmlDialog(Find.ByTitle(PageTitle));
fileUploadDialog.WaitForComplete();
FileUpload fileUpload = fileUploadDialog.FileUpload(Find.ById(new Regex("_FileUpload")));
fileUpload.Set(fileName);
Image image = fileUploadDialog.Image(Find.BySrc(new Regex("/icons/upload.png")));
Element parentElement = image.Parent;
parentElement.FireEventNoWait("onmouseup");
parentElement.FireEventNoWait("onmousedown");
}
The Upload File Dialog is open from Internet Explorer Modal Dialog Window.
I'm using Watin in C# console app to crawl websites, there are five console app running at the same time. The reason I partly use Watin as crawler is because a few websites use javascript(or ajax) to set page content.
Following is the sample code to get a page comment count:
Settings.Instance.MakeNewIeInstanceVisible = false; using (var browser = new IE(commentLink, true)) { browser.Link(Find.ByUrl(commentLink)).WaitUntilExists(20); Span commentSpan = browser.Span("COUNT_TOTAL"); if (commentSpan.Exists) { int commentCount; if (Int32.TryParse(commentSpan.InnerHtml, out commentCount)) { return commentCount; } } }
My problem is after running these 5 console app for a while (90 min), a lot of IE instances are stayed open (because of timeout or error or IE is busy), so the system is quite slow and need to reboot. How do I change my code to prevent this thing happen and make my apps stay effecient?
I always used ASP FileUpload with great success, but recently tried to modify its appearance in order to blend in with the general appearance of the project. After extensive research I discovered that in this particular case it would not be possible and opted for an alternative.While not wanting to lose the functionality of the ASP FileUpload I hid the ASP FileUpload and rather just added a read-only textbox and button which I styled with ease. Subsequently I invoked the ASP FileUploads file browse window using Javascript. Consider the following:
Code: <script type="text/javascript"> function ShowBrowseDialog() {
[code]...
The above works fine for invoking the ASP FileUpload and selecting the file, but I need to work with the selected file(s) in the code-behind. Is there a way that I can trap a click event on the ASP FileUpload OPEN button, i.e. once the user selected the file(s)?
Let's say you set maxRequestLength to the max number (2097151) (units are KB) and use the following code for your OnClick event for your submit button:
int int fileSize = FileUpload1.PostedFile.ContentLength;
if (fileSize < 2000000)//units are bytes Label1.Text="too big"; else { FileUpload1.SaveAs(saveItHerePath); Label1.Text = "Upload success."; }
Why when a huge file is attempted does it take a minute to get to the OnClick event on the server? Because if maxRequestLength were set to that value 2000, it would immediately choke if you tried to upload a 500MB file. What is going on here? What are the best practices for using the FileUpload control? Is there a better alternative way of uploading or checking for file size?
I have a Data Grid View which display values from a SQL Query, and inside the data grid view I have two template fields one is Quantity and it is a text box and the other is Total Price and it is a label.
What I want to do is to insert a button called update and when I press this button the price Column should be multiplied by the quantity Column and the result should be displayed in the total Column.
I have combobox & button in my webpage, if i select a value from the combobox, then i click the button the page is refreshing, combobox value is changing.For Example Combobox value: 1, 2, 3, 4 .....If i selected 2 then i press the button, webpage is refreshing, combobox values is display from: 1, 2, 3, 4....Combobox should display 2Why combobox is displaying a selected value when i press the button.
Table Name: user
Name username
Raja 1 Ravi 2 Ram 3 kumar 4 ...,
Button click event code
cmd1 = new OdbcCommand("Select name from users where username = '" + combobox1.Items[combobox1.SelectedIndex].Text + "' ", dbcon); dr1 = cmd1.ExecuteReader();
[code]...
The Above code is working, but if i select the value 2 from the combobox, then i press the button textbox should display ravi, but textbox is displaying Raja, and also combobox also refreshing, combobox is not displaying 1 instead of 2.
Have a form with a button and some text fields on it.When I hit enter after filling a field the event for the button fires up event onClick.How can I get around this since on one of the fields I have a textchangeEvent I to fire up.
I have a page to display user's photo and when user press either left or right, it will evoke direct user to the previous or next photo of his/her.By and large, it is akin to facebook feature (when we view our photo and press left or right, we can jump to our previous or next photo).
I have an AJAX PopupExtender that popsup a panel with submit button. I want to recognise the enter key press as the click event for the submit buttNeed to set the form property called "AcceptButton" to this button to achieve this functionality. I have two popups with a submit button on each of them. How to set this behaviour ?
What is the best solution for adding Textbox controls dynamically to a page when a button is pressed?
The secnario is: "The page initially loads with 3-4 textboxes already displayed but the user needs another textbox added. They click add textbox and another textbox control appears."
I would hope to be able to do this within a updatepanel and use AJAX async postback.
- I'm using a RequiredFieldValidator to check whether the text box is empty. I only wanted this validation to run when I press one specific button.
- I dont want the validation to be done on every button control within a page. For example, i have 2 buttons, one is showing a list of data and another will be checking for an empty text boxes. So, when I click the show list button, I dont want the validation to be run, what I want is the validation to be run on the check empty text boxes button.
I have an ASP.NET GridView that has four columns. The first three are typical BoundField elements bound to a DataTable. The forth is a TemplateField element that I create a DropDownList in on the OnRowCreated event for the GridView.
What I'm attempting to do is walk down the data source for the GridView when a button is pressed. I really just need to get the values for columns one and four of each row. The first three columns have data as expected but the forth is displaying as empty. Is this because it wasn't a part of the DataTable originally? Is there any way to get the value for each drop down as I've described it, or will I need to rework this so each drop down list is a part of the DataTable?
If I'm on a searchable site (example.com for example) and search some data then get a dropdown list, when I click on one of the items, then try to use the browser's back button to go back, I get the error "the page cannot be displayed". Does this have something to do with cookies or history settings?
I don't have this problem with mozilla, but I prefer to use IE for other reasons.
How can one fire a button click event when someone presses Enter in Textbox. I had a master page on which Search button & a Textbox for writing Search text is there. When one clicks on "Search" button, it works fine. But when one presses Enter, no search results are displayed.
I am trying to build a form that will not change the URL in the users browser, and will not allow the user to press the browser back button. Is there something I can do to accomplish this?
I have a page on which the user can define a query. When done, the user enters a name for the query and presses a button. I'd like to process the button click, make a text label (or Span) visible for a few seconds and then have it fade out.
Since it is a postback, I can turn an ASP:Label control to visible - that's easy. Now how do I get jquery to make the label fade away after a few seconds? In a broader sense, how do you get a postback to trigger a jquery method?