Hi,
I have bound data to an InputFormview that I have made:
SqlConnection myCon = Connect("myDb");
string query = "Select * from MyTable";
DataTable aSample = new DataTable();
SqlDataAdapter aSampleAdapter = new SqlDataAdapter(query,myCon);
InputFormview.DataSource = aSample;
InputFormview.DataBind();
And then in the .aspx file
<input id="Si" value="<%# Eval("Silicon") %>" />
This works fine, it puts the values where I want them.
So, then after I have updated my values, I want to save them, this is where I stumble. If I were making a WindowsForm I would just do
aSampleAdapter.Update(aSample);
Provided that aSampleAdapter and aSample is accessible from my SaveButton_OnClick function.
But how do I do this for a Web application? If I do the same my Savebutton will do a postback before it actually runs my function, so it will clear aSampleAdapter and aSample (and everything else), then it will do PageLoad and then it will run my Savebutton_OnClick function...
Can I do this without doing a postback? Or am I totally wrong in how I approach this?
Thanks,
Mattias