My task: In a website(my university website) when results are generated using my code automatically the roll number's will be incremented and results wil 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 values(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.
the univ page code:

<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 
onload="javascript:document.forms['result']['regno'].focus()">
<FORM name=result onSubmit="return checkregno();" action=/cgi-bin/result/resgrbarchpg.pl 
method=post>
<INPUT maxLength=14 size=14 name=regno>
<INPUT onClick="return checkregno();" type=submit value=Submit> 
<INPUT type=reset value=Clear name=clear>

Is there anything missing from the form that you haven't posted? That doesn't particularly look like it does anything.

Have you tried just calling the action in the browser with no parameters to see what happens?

@Ketsuekiame i have just posted the main tags which they use in the code,because i think other details are not needed,and i dont know how to call the action in the browser also,pls provide a code for it..thank you

Well you should probably post the entire form at least up to the closing tags for it.

To call the action you need to put the domain of the site followed by the action.

So if your domain was www.bob.com, you would need to enter www.bob.com/cgi-bin/result/resgrbarchpg.pl

Beyond that, there just isn't enough information to do any more...

@ketsuekiame
this is the code:
how do i access the onsubmit function now? using my c# code..will htmlagility pack work?am new to .net so pls help.
thanks in advance

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0045)http://ns.annauniv.edu/ugresults/results.html -->
<HTML><HEAD><TITLE>UG Examinations Results</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<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 
onload="javascript:document.forms['result']['regno'].focus()">
<FORM name=result onSubmit="return checkregno();" action=/cgi-bin/result/resgrbarchpg.pl 
method=post>
<P>&nbsp;</P>
<P>&nbsp;</P>
<DIV align=center>
<TABLE borderColor=#ffffff height=236 cellSpacing=0 cellPadding=0 width=562 
border=0>
  <TBODY>
  <TR bgColor=#003366>
    <TD height=26 colSpan=5 align=right borderColor=#ff0000 borderColorLight=#996633 
    borderColorDark=#cc3300 bgcolor="#330000">
      <P align=center><B><FONT face="Courier New, Courier, mono" color=#ffffff 
      size=3>Anna University,Chennai</FONT></B> </P></TD></TR>
  <TR bgColor=#003366>
    <TD height=26 colSpan=5 align=right borderColor=#ff0000 borderColorLight=#996633 
    borderColorDark=#cc3300 bgcolor="#330000">
      <P align=center><B><FONT face="Courier New, Courier, mono" color=#ffffff 
      size=3>Controller of Examinations </FONT></B></P></TD></TR>
  <TR bgColor=#003366>
    <TD height=41 colSpan=5 align=right borderColor=#ff0000 bgcolor="#330000">
      <P align=center><B><FONT face="Courier New, Courier, mono" color=#ffffff 
      size=3> MBA/MCA/ME/MTECH/BARCH Results April / May 2013 <br> (Grade System) </FONT></B></P></TD>
  </TR>
  <TR>
    <TD borderColor=#ff0000 align=right bgColor=#330000 colSpan=5 height=12>
      <P align=center><B></B></P></TD></TR>
  <TR>
    <TD width="12" height=157 
    rowSpan=6 align=right borderColor=#003366 bgColor=#330000>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=220 bgColor=#fffaea 
    height=27>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=283 bgColor=#fffaea 
    height=27>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=29 bgColor=#fffaea 
    height=27>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=18 bgColor=#330000 height=149 
    rowSpan=5>&nbsp;</TD>
  </TR>
  <TR>
    <TD borderColor=#ff0000 align=right width=220 bgColor=#fffaea 
    height=27>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=283 bgColor=#fffaea 
    height=27>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=29 bgColor=#fffaea 
    height=27>&nbsp;</TD>
  </TR>
  <TR>
    <TD borderColor=#ff0000 align=left width=220 bgColor=#fffaea height=32>
      <P align=right><FONT face=Courier color=blue><B>Registration 
      No:</B></FONT> </P></TD>
    <TD borderColor=#ff0000 align=right width=283 bgColor=#fffaea height=32>
      <P align=left><INPUT maxLength=14 size=14 name=regno> </P></TD>
    <TD borderColor=#ff0000 align=right width=29 bgColor=#fffaea 
    height=32>&nbsp;</TD>
  </TR>
  <!--TR>
    <TD borderColor=#ff0000 align=left width=220 bgColor=#fffaea 
      height=27><div align="right"><FONT face=Courier color=blue><B>Date of Birth:<br>
      <strong>( </strong><font color="#FF0000">dd<B><FONT face="Courier New, Courier, mono" 
      size=3>/</FONT></B>mm<B><FONT face="Courier New, Courier, mono" 
      size=3>/</FONT></B>yy</font><strong>)</strong></B></FONT></div></TD>
    <TD align=right width=283 bgColor=#fffaea height=27><div align="left">
      <INPUT maxLength=10 size=12 name=dob>
      <strong>(Example: </strong><font color="#FF0000">01<B><FONT face="Courier New, Courier, mono" 
      size=3>/</FONT></B>05<B><FONT face="Courier New, Courier, mono" 
      size=3>/</FONT></B>94</font><strong>)</strong> </div></TD>
    <TD borderColor=#ff0000 align=right width=29 bgColor=#fffaea 
    height=27>&nbsp;</TD>
  </TR-->
  <TR>
    <TD borderColor=#ff0000 align=left width=220 bgColor=#fffaea height=36>
      <P align=right> </P></TD>
    <TD borderColor=#ff0000 align=right width=283 bgColor=#fffaea 
    height=36>&nbsp;</TD>
    <TD borderColor=#ff0000 align=right width=29 bgColor=#fffaea 
    height=36>&nbsp;</TD>
  </TR>
  <TR>
    <TD borderColor=#ff0000 align=right bgColor=#330000 colSpan=4 
    height=8>&nbsp;</TD>
  </TR></TBODY></TABLE></DIV>
<DIV align=center>
<TABLE height=38 width="67%" border=0>
  <TBODY>
  <TR>
    <TD height=36>
      <DIV align=center><INPUT onClick="return checkregno();" type=submit value=Submit> 
<INPUT type=reset value=Clear name=clear> <INPUT onclick=dele() type=button value=Back name=del> 
  </DIV></FORM></TR></TBODY></TABLE></DIV>
<P>&nbsp;</P></BODY></HTML>

You will need to use ScriptManager.RegisterClientScriptBlock and register the control that calls the script to the block of code that you want to call.

This is a link about the ScriptManager

@ketsuekiame thank you for your reply.,can u post some examples.,
thanks in advance.

ScriptManager.RegisterClientScriptBlock(btnCheckReg, btnCheckReg.GetType(), "CheckReg", "return checkregno();", false);

thank you for the reply :) @Ketsuekiame still i have few doubts.,how do i specify the btncheckreg value?should i use htmlagility pack to retireve the html source and do.,or what should be the value in btnCheckReg..

Depends how you want to do it really, but the button should be one that is part of the form that you are retrieving, otherwise it won't be able to call the Postback.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.