Info from database is displayed in textbaoxes. User can edit info then press update button. I had it working before but now that I'm getting the ID number for the record off another page it stops working.
When the update button is pressed the info resets to the original info.
Any ideas???
Much appreciatedAre you databinding on the page_load event? If so you need to check for
if Not Page.IsPostBack then
'DataBind Here
End If
EricSorry but what do I databind?
My page_load is:
answer = Trim(Request.QueryString("ID"))
SqlDataAdapter1.SelectCommand.CommandText = "SELECT ID, Category, Question, Answer, Keywords, DateAdded, CreatedBy, Status FROM log WHERE ID='" & answer & "'"
SqlDataAdapter1.Fill(DS, "log")
If DS.Tables("log").Rows.Count > 0 Then
Row = DS.Tables("log").Rows(0)
idtext.Text = Row.Item("rfqID")
CategoryText.Text = Row.Item("Category")
QuestionText.Text = Replace(Row.Item("Question"), vbCrLf, "<br>")
AnswerText.Text = Replace(Row.Item("Answer"), vbCrLf, "<br>")
KeywordsText.Text = Replace(Row.Item("Keywords"), vbCrLf, "<br>")
DateAddedText.Text = Replace(Row.Item("DateAdded"), vbCrLf, "<br>")
CreatedByText.Text = Replace(Row.Item("CreatedBy"), vbCrLf, "<br>")
StatusText.Text = Replace(Row.Item("Status"), vbCrLf, "<br>")
End If
End Subput that if statament I wrote around this code you posted. What is happening is when it loads it is filling in the values so that is why it is resetting.
Eric
EricOk lovely thanks
When the update button is pressed the info resets to the original info.
Any ideas???
Much appreciatedAre you databinding on the page_load event? If so you need to check for
if Not Page.IsPostBack then
'DataBind Here
End If
EricSorry but what do I databind?
My page_load is:
answer = Trim(Request.QueryString("ID"))
SqlDataAdapter1.SelectCommand.CommandText = "SELECT ID, Category, Question, Answer, Keywords, DateAdded, CreatedBy, Status FROM log WHERE ID='" & answer & "'"
SqlDataAdapter1.Fill(DS, "log")
If DS.Tables("log").Rows.Count > 0 Then
Row = DS.Tables("log").Rows(0)
idtext.Text = Row.Item("rfqID")
CategoryText.Text = Row.Item("Category")
QuestionText.Text = Replace(Row.Item("Question"), vbCrLf, "<br>")
AnswerText.Text = Replace(Row.Item("Answer"), vbCrLf, "<br>")
KeywordsText.Text = Replace(Row.Item("Keywords"), vbCrLf, "<br>")
DateAddedText.Text = Replace(Row.Item("DateAdded"), vbCrLf, "<br>")
CreatedByText.Text = Replace(Row.Item("CreatedBy"), vbCrLf, "<br>")
StatusText.Text = Replace(Row.Item("Status"), vbCrLf, "<br>")
End If
End Subput that if statament I wrote around this code you posted. What is happening is when it loads it is filling in the values so that is why it is resetting.
Eric
EricOk lovely thanks