Send form to SQL DB and bring it in table

2

I am working with WebForms, my form is as follows:

 <div class="form-group formulario" id="formulariogral">
    <form action="">
            <div id="titulos">
                <h1 class="title" >titulo</h1>
                <h3 class="title" >subtitulo</h3>
            </div>
            <label>Title</label>
            <input type="text" class="form-control" placeholder="title" id="" />

            <div class="form-group">
                <div class="formulario">
                    <div class="form-group">
                        <label>Effective Date</label>
                        <div class="input-group date" id="datepicker1">
                            <input type='text' class="form-control" />
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                        </div>
                    </div>
                </div>
                <div class=' formulario'>
                    <div class="form-group">
                        <label>Expiration Date</label>
                        <div class='input-group date' id="datepicker2">
                            <input type='text' class="form-control" />
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar"></span>
                                </span>
                        </div>
                    </div>
                </div>
                </div>

            <div class="select formulario">

                <select class="form-control">
                  <option>Safety</option>
                  <option>Material</option>
                  <option>Quality</option>
                  <option>Operations</option>
               </select>
            </div>

            <div>
                <label>Coments</label>
                <textarea rows="5" cols="50" class="form-control"></textarea>
            </div>
            <!-- end form-->

            <div id="submit">
                <input class="btn btn-default" type="submit" value="Submit" style="display:block; margin-top:20px; margin-left:10px;">
                <hr style="border:1px groove black; width:15%; float:left; display:block"/>
            </div>

           </form>



            </div>

How can I send the data to my database and bring it as a table to a page other than the one I sent it through the CodeBehind or the sending from aspx?

    
asked by matteo 26.05.2016 в 18:01
source

2 answers

1

I do not understand the part of sending it to the database very well. If you are busy transferring information from one place to another, you can use session variables, you are happy that you can save a string , a int , a class, a DataGridView , a DataSet , DataTable , simply to assign the value would be as follows:

Session["nombreVarSession"] = new DataTable(); //un DataSet por Ejemplo

Then to retrieve it on the other side you simply access the session variable and cast it.

DataTable nombreVariable = (DataTable)Session["nombreVarSession"];

After you necessarily have to send the information to the database and the result of the process show it on another page, you can execute events when the page is loaded for the first time, both in the back code and in the the html part, here I leave the two forms.

// Back Code

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        //ejecutas lo que quieras hacer

    }
}

// html

<html>
  <body>
	<script language="Javascript" type="text/javascript">
		window.onload = function()
		{
			//ejecutas lo que quieras hacer
		}
	</script>
  </body>
</html>
    
answered by 27.10.2016 / 18:16
source
-1

The following tutorial can help you perfectly for what you need, I hope it works for you.

link

    
answered by 12.10.2016 в 02:26