i use this code below, the problem is this code below does not update automatically when i press the button
i need to press the F5 button to get the latest value..what sholud i do, i want the value automatically update when i press the button
If drpPilihan.SelectedValue = "Merit" Then
cmd.CommandText = "Select Sum(MataMerit) From MataMerit Where IdPelajar=@Idpelajar"
cmd.Parameters.AddWithValue("idpelajar", lblIdPelajar.Text)
totalmerit = cmd.ExecuteScalar().ToString
lbltotal.Text = ""
lbltotal.ForeColor = Drawing.Color.Black
If totalmerit <> "" Then
lbltotal.Text = "Jumlah Mata Merit: " + totalmerit
If totalmerit >= 200 Then
lbltotal.ForeColor = System.Drawing.Color.BlueViolet
End If
End If
afastars
Member
52 Points
221 Posts
ExcuteScalar Update
Nov 29, 2012 01:34 PM|LINK
i use this code below, the problem is this code below does not update automatically when i press the button
i need to press the F5 button to get the latest value..what sholud i do, i want the value automatically update when i press the button
If drpPilihan.SelectedValue = "Merit" Then cmd.CommandText = "Select Sum(MataMerit) From MataMerit Where IdPelajar=@Idpelajar" cmd.Parameters.AddWithValue("idpelajar", lblIdPelajar.Text) totalmerit = cmd.ExecuteScalar().ToString lbltotal.Text = "" lbltotal.ForeColor = Drawing.Color.Black If totalmerit <> "" Then lbltotal.Text = "Jumlah Mata Merit: " + totalmerit If totalmerit >= 200 Then lbltotal.ForeColor = System.Drawing.Color.BlueViolet End If End IfEnd If
augustwind
All-Star
35860 Points
4900 Posts
ASPInsiders
Moderator
Re: ExcuteScalar Update
Nov 29, 2012 01:43 PM|LINK
You said you wanted it to update automatically.
In what way?
All Things Dot Net
Stored Procs and Code in a Flash!
ASP.Net Sitemap Creator
msmk
Participant
776 Points
158 Posts
Re: ExcuteScalar Update
Nov 29, 2012 01:44 PM|LINK
Set the dropdownlist's autoPostBack property to true
afastars
Member
52 Points
221 Posts
Re: ExcuteScalar Update
Nov 29, 2012 02:18 PM|LINK
hai all expertise
when i click the button to save, the value does not update..so i want the value immedietly update so how it can be done
for you information the button now in update panel...hope can help me to give solution or suggestion
msmk
Participant
776 Points
158 Posts
Re: ExcuteScalar Update
Nov 29, 2012 02:21 PM|LINK
Put the label inside the update panel as well
afastars
Member
52 Points
221 Posts
Re: ExcuteScalar Update
Nov 29, 2012 03:09 PM|LINK
yes resolve already tq so much