hello, i'm new to asp.net so please bare with me
so far i have a grid view bound to an xml data source, when the user clicks on edit on whatever row it will open up a new view, this view holds 3 text boxes. Each textbox is populated with the selected row's data.
my question is how can i update the value of the gridview's row by clinking on the "update" button located in this view
the view in the aspx file :
<asp:View ID="edit" runat="server" >
id | <asp:TextBox ID="editid" runat="server" >
|
name |
<asp:TextBox ID="editname" runat="server" >
|
info |
<asp:TextBox ID="editinfo" runat="server" >
|
<asp:Button Text="update" ID="update" runat="server" OnClick="update_Click" />
linked it with the gridview when the user clicks on edit.
code behind file :
protected void gv1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "eddit")
{
//view 2 used for editing and updating
MultiView1.ActiveViewIndex = 2;
GridViewRow row = (GridViewRow)((Control)e.CommandSource).Parent.Parent;
//linked my textboxes to the labels in the gridview
editid.Text = (row.FindControl("labelid") as Label).Text;
editname.Text = (row.FindControl("labelname") as Label).Text;
editinfo.Text = (row.FindControl("labelinfo") as Label).Text;
}
}
how do i save the values i typed in the text boxes to the gridview's selected row or save it to the xml file?
protected void update_Click(object sender, EventArgs e)
{
// i want to add some code here to update the values from the textbox to the selected row. is this possible
}
i'm sorry for the stupid question but i am at a loss.
thank you very much for your help, and please bare with me i am a beginner in this