My task: In a website(my university website) when results are generated using my c#(windows or web application) code automatically the roll number's will be incremented and results will be stored in my database.i need to supply values for a textbox in the university website from my code.,im ABLE to find the html input tag name(regno) for the textbox.,the problem is,the HTML page is using onSubmit event with return valuesonSubmit="return checkregno();"(to validate the roll no entered in the textbox) and it is redirected to another page(the output results page).How to do i supply values to the onSubmit method (from my C# code)such that it returns "true"and i should be able to retireve the values from the output page also.pls help,i dont know where to start,or how to start.
<SCRIPT language=JavaScript>
<!--
function checkregno()
{
if (window.RegExp)
{
strval=document.forms["result"]["regno"].value;
reExp=new RegExp("^\\d{14}$");
}
function dele()
{
document.result.action="http://www.annauniv.edu";
document.result.submit();
}
</SCRIPT>
<META content="MSHTML 6.00.2800.1491" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=gray
önload="javascript:document.forms['result']['regno'].focus()">
<FORM name=result önSubmit="return checkregno();" action=/cgi-bin/result/resgrbarchpg.pl method=post>
<INPUT maxLength=14 size=14 name=regno>
<INPUT önClick="return checkregno();" type=submit value=Submit>
<INPUT type=reset value=Clear name=clear>
now how do i send data to the onSubmit function from my code,im not an expert in .net.
the code i use to retrieve the page source is:
static string GetHtmlPage(string strURL)
{
String strResult;
WebResponse objResponse;
WebRequest objRequest = HttpWebRequest.Create(strURL);
objResponse = objRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
strResult = sr.ReadToEnd();
sr.Close();
}
return strResult;
}
protected void Button1_Click(object sender, EventArgs e)
{
string tablecode = null;
String TheUrl = "http://www.annauniv.edu/1234566789/grbarchpg.html?regno=23010205001";
string response = GetHtmlPage(TheUrl);
tablecode = response;
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(@tablecode);
TextBox1.Text = tablecode;
}