Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by HuaMinChen
at 2024-08-09 00:28:45
Point:110 Replies:3 POST_ID:828718USER_ID:11615
Topic:
.NET;C# Programming Language;Components
Hi,
I have a Gridview to show the detail records on the page. Upon saving the header record on the page, do I need to specifically fire
OnRowUpdating
event of the Gridview to save the detail records?
I have a Gridview to show the detail records on the page. Upon saving the header record on the page, do I need to specifically fire
OnRowUpdating
event of the Gridview to save the detail records?
Author: HuaMinChen replied at 2024-08-09 20:16:09
Any help to this?
Author: HuaMinChen replied at 2024-08-09 02:46:40
I have the RowUpdate event like
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GridView1.Rows[e.RowIndex] as GridViewRow; int obj_id = Convert.ToInt16(lb_userid.Text); TextBox tb_ite_id = row.FindControl("tb_ite_id") as TextBox; TextBox tb_ite_id2 = row.FindControl("tb_ite_id2") as TextBox; TextBox tb_ite_desc = row.FindControl("tb_ite_desc") as TextBox; Label lblchangedate = row.FindControl("lblchangedate") as Label; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Mssqlconn2"].ConnectionString)) { string sql = "Update tab5 set ite_id = @ite_id,ite_desc=@ite_desc, change_date= @change_date" + " where obj_id=@obj_id and ite_id=@ite_id2"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue( "@ite_id", Convert.ToInt16(tb_ite_id.Text)); cmd.Parameters.AddWithValue( "@ite_desc", tb_ite_desc.Text.Trim()); cmd.Parameters.AddWithValue( "@change_date", Convert.ToDateTime(lblchangedate.Text)); cmd.Parameters.AddWithValue( "@obj_id", obj_id); cmd.Parameters.AddWithValue( "@ite_id2", Convert.ToInt16(tb_ite_id2.Text)); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } } GridView1.EditIndex = -1; this.PopulateData(); } 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:
do I need to run this for each Gridview record? How about the way to call this event?
Accepted Solution
Expert: duncanb7 replied at 2024-08-09 01:57:34
110 points EXCELLENT
Did you take a look at link ?
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowupdating.aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowupdating.aspx