i want to add an update query in my Gridview.aspx.cs file but its show error that text boxes is not exist in current context
if i add Grid view and my registration page in same page than i can access my Textboxes ID but i want to add grid view in another page so that user can add data in one page and its redirect to my gridview
Hope you got me
try
{
SqlConnection conn = new SqlConnection("Data Source=DESKTOP-KNR6L52;Initial Catalog=FarhanDB;Integrated Security=True");
conn.Open();
string insertQuery = "Insert into AddRecord (InternalRecieving,Department,DepartmentType,Orignization,OrignizationType,FileNumber,Date,Subject,FileName,Status)Values(@Fname,@lname,@CNIC,@Gnder,@Mb1,@Mb2,@datebirth,@EmailId,@WD,@Pkge)";
SqlCommand com = new SqlCommand(insertQuery, conn);
com.Parameters.AddWithValue("@Fname", InternalRecievingbox.Text);
com.Parameters.AddWithValue("@lname", Departmentbox.Text);
com.Parameters.AddWithValue("@CNIC", DpartmnttypeID.Text);
com.Parameters.AddWithValue("@Gnder", orignizationbox.Text);
com.Parameters.AddWithValue("@Mb1", orignizationtypebox.Text);
com.Parameters.AddWithValue("@Mb2", filenumbox.Text);
com.Parameters.AddWithValue("@datebirth", datebox.Text);
com.Parameters.AddWithValue("@EmailId", subjctbox.Text);
com.Parameters.AddWithValue("@WD", filanmebox.Text);
com.Parameters.AddWithValue("@Pkge", ststbox.Text);
com.ExecuteNonQuery();
Response.Write("alert('Your Regestration is Successfull')");
Response.Redirect("Showtable.aspx");
conn.Close();
}
catch (Exception ex)
{
Response.Write("Error." + ex.ToString());
}
What I have tried:
I have tried only one thing that is "add Grid view and my registration page in same page than i can access my Textboxes but i want to redirect it on gridview page as i mentioned above"
Here is my code