Fill fields on website
I am opening up a web page from a link button.
My issue is populating this web page with data that I need to be pre-populated in s开发者_Go百科ome of the fields on that web page.
Can anyone please assist?
Many thanks in advance
Because this involves cross-domain posting of data, you are limited in the approaches that you can take.
If you can guarantee that this will only be small amounts of data, you could pass it in the QueryString. Another alternative is on the click event of the linkbutton, save the data to disk or a database, and pass a reference in the QueryString. This reference might be a filepath if the sites are hosted together or a table id if the sites have access to the same database.
Neither of these approches are ideal. You should provide more information such as how the domains are related if at all and whether they can be hosted in the same App Pool. Do you control the code for both sites?
Perhaps you are asking how to pass variables via the query string:
http://www.aspnet101.com/2007/07/querystring-results-and-sql-statements/ http://www.codeproject.com/KB/aspnet/QueryString.aspx
That is a very useful skill. Then you can create hyper-links (you "link buttons") with query string variables in them:
http://www.informit.com/articles/article.aspx?p=28493&seqNum=3
Based on the requirements that you have stated in the comments on other answers, you cannot set the form fields on the 3rd party site unless you create some sort of browser addin. If this for an in-house purpose, that you would not need the general public to use, you could create firefox or chrome addin to do this. The addin could read the values off the page the link button is on and then apply them to the following page. You may be able to create a greasemonkey script to do this too.
精彩评论