I'm edited my question,
I have a submit button and textbox in Default.aspx page. I'm open two window Default.aspx. I want to input text into textbox and press submit in this window, other window will update textbox real time.
Please help me !
What you are looking for is similar to chat application.
On receiving a value from one client(browser window), you want to send it to another.
Take a look at SignalR is a good option to keep push data to connected clients.
However if you do want to do it yourself for some reason, the most efficient method to build this in asp.net is to use a IHttpAsyncHandler and ajax requests.
Here is a complete working project that implements this, along with ajax.
Related
[edit] It is a requirement that the webpage spawn and open in IE and allow user manual interaction after the programmatic actions have completed.[/edit]
I've seen a lot of code examples online about opening webpages or filling in webpage textboxes and getting a return value without ever opening them visibly.
I would like to open a webpage in IE, fill in a few textbox buttons
and then click the submit button and view the results visibly.
I am able to do this with a dll called Selenium, but I do not want to use a 3rd party application and it seems that WebBrowser() should be able to do this?
I can post my failed code examples if that would help.
Thanks.
Maybe this qould fit better as a comment, but I don't have enoigh reputation.
Do you know how HTTP-Forms work?
It would probably be easier to send a HTTP-Request to the target of the form you want to fill, including the parameters you would like to fill into the form.
So you don't need any WebBrowser or similar, just a simple HttpWebRequest object, where you specity the target, the method (very likely POST) and the data you'd like to send.
You can use the webbrowser control in Winforms. It is possible to access every DOM object of the website using the control. No need to open the IE externally.
You just need to specify the webbrowser URL as your link.
Then, fill the textboxes with code,
BrowserID.Document.GetElementById("TextboxID").SetAttribute("Value", "NewVaue")
Also, you can click on the button using InvokeMember("click").
There are lots of stuff using WebBrowser. You can learn it here.
I am trying to implement a KeyDown event for a textbox in Visual Web Developer. I am using C#. I know how to do this in a windows form but the technique isn't portable to VWD. I want to capture the text in the textbox when the user hits Enter.
Any advice is appreciated.
Regards.
Sounds like you may want to read up a bit on Web forms in general. A quick summary:
Since web pages are all client side, you have to explicitly tell it when to talk to the server where all the major lifting takes place.
So you have the html form tags:
<form>
</form>
and all important text boxes and other form controls go between.
Then you need a submit button which under normal circumstances is the only way to submit the form to the server for processing. (The "enter" key activates the submit key also.). Submission always either reloads the page or causes a move to the next page, depending on the actions specified.
ASP.NET does take care of a lot of page events and such for you. as you have probably noticed by now, though, when you right click a text box and look at the available events, you only have a few, such as "textchanged". This is because anytime you do not actually submit a form to the server, you need AJAX to do a call to the server for you while not reloading the page. the "textchanged" event on a textbox is still going to be AJAX driven - it's just the Microsoft has built it in for you. You will want to look at either jQuery or the ASP.Net AJAX libraries.
You say you want to "store" the result - is it to generate new behavior later on the page? that's AJAX. Is it for longevity while the entire application is worked through? That can wait until the submit.
Actually the textChanged method waits for the Enter key to be hit.
I have a table of data. I would like the user to be able to select a row and view the details in a jquery modal dialog.
I have this working fine. Based on permissions, the user may be able to edit the data in the modal. In this case, I would like to present a button to switch to "edit" mode.
Would it make sense for this button to load a new partial Edit view into the modal? or should I just combine the Read-only and Edit forms into a single view thats loaded intially and use javascript/css to hide the Edit Form until needed?
I think it's more of a design question as long as you don't send the Edit Form to the client side and only hide in case when the user doesn't have the permission to edit it.
Otherwise you'll be better of discussing this with the stakeholders.
In my personal opinion, I simply hate Modals. They just tend to be very overwhelming but that's just me :)
Why would you waste network traffic by downloading both views together? I would use separate ajax call to download edit form.
1. If your edit form is large in html size, you would waste traffic when downloading together (User may never press the edit button)
2. If edit form is relatively small, switching to it via ajax downloading would be almost transparent to user - no extra timing, no extra traffic waste
I have a website to which I need to pass 4 parameters and then extract data programmatically but there is a big problem. The website is built into ASP.NET with FORM inside AJAX. So, I can fill one field programmatically and then I fill second field. There is a need to click a button in order to fill third field so I press button programmatically then. The problem is that when I click the button, the second fill gets empty before calling the button event and causes error.
So is there a way I can sharply fill fields without causing errors?
Take a look at web automation library such as WatiN - this lets you do this kind of interaction.
I agree with Oded and would like to add that as an alternative Selenium RC in combination with NUnit might be an option.
I believe IRobotSoft web scraper can do this kind of work. You will use two form filling actions, and add a Click action between them.
Is there any builtin control in ajax to show process indicator. Like when i press copy button in my page one popup shuold come and show a small process animation gif.
is it possible in ajax using c#?
Some time ago I need to do this in my web site and I've found this page. Check this out and see if fits to your needs.
http://mattberseth.com/blog/
Cheers,