udate doesn't work as expect need help

G

Guest

I have two datalist in two panel (viewdatalistpanel and updateDatalist). One
datalist bring all student details from the database and the other update the
student details in the database. On page load the viewdatalistpanel is
visible, when a button is click it become invisible and the updatedatalist
becomes visible. Every thing works fine. But when i click the
updateStudent_Click button, the details do not update and also instead of
taking me to the viewdatalistpanel to display the updated details, it come up
with an blank page. Below is the all the sub in my <script>...</script>
portion of the page: i need help


<script runat="server">
Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
Dim StudentID As Integer = CInt(Request.Params("studentID"))
Dim SimpleSearch As New StudentDB()

ViewDataList.DataSource =
SimpleSearch.StudentState(Request.Params("studentID"))
ViewDataList.DataBind()

ViewDetailsPanel.Visible = True
UpdateDetailsPanel.Visible = False
Else
Dim StudentID As Integer = CInt(Request.Params("studentID"))
Dim SimpleSearch As New StudentDB()

UpdateDataList.DataSource =
SimpleSearch.StudentState(Request.Params("studentID"))
UpdateDataList.DataBind()

ViewDetailsPanel.Visible = False
UpdateDetailsPanel.Visible = True
End If
End Sub

Sub BindViewPanel()
If Page.IsValid = True Then
Dim StudentID As Integer = CInt(Request.Params("studentID"))
Dim SimpleSearch As New StudentDB()

ViewDataList.DataSource =
SimpleSearch.StudentState(Request.Params("studentID"))
ViewDataList.DataBind()

UpdateDataList.Visible = False
'UpdateDataList.DataSource =
SimpleSearch.StudentState(Request.Params("studentID"))
'UpdateDataList.DataBind()
End If
End Sub


Sub showUpdateDetails_Click(ByVal Sender As Object, ByVal e As
EventArgs)

ViewDetailsPanel.Visible = False
UpdateDetailsPanel.Visible = True
End Sub


Sub UpdateStudent_Click(ByVal sender As Object, ByVal e As EventArgs)

If Page.IsValid = True Then
Dim StudentID As Integer = CInt(ViewState("StudentID"))
Dim tbTitle As TextBox
Dim tbStatus As TextBox
Dim tbSurname As TextBox
Dim tbFirstname As TextBox
Dim tbHouseNumber As TextBox
Dim tbStreet As TextBox
Dim tbTown As TextBox
Dim tbCounty As TextBox
Dim tbCountry As TextBox
Dim tbPostcode As TextBox
Dim tbDateOfBirth As TextBox
Dim tbNationality As TextBox
Dim tbTelephone As TextBox
Dim tbMobile As TextBox
Dim tbEmail As TextBox
Dim tbFax As TextBox
Dim tbCourseID As TextBox
Dim tbDateEnroled As TextBox
Dim tbComment As TextBox

Dim item As DataListItem
For Each item In UpdateDataList.Items
tbTitle = item.FindControl("Title")
tbStatus = item.FindControl("Status")
tbSurname = item.FindControl("Surname")
tbFirstname = item.FindControl("Firstname")
tbHouseNumber = item.FindControl("HouseNumber")
tbStreet = item.FindControl("Street")
tbTown = item.FindControl("Town")
tbCounty = item.FindControl("County")
tbCountry = item.FindControl("Country")
tbPostcode = item.FindControl("PostCode")
tbDateOfBirth = item.FindControl("DateOfBirth")
tbNationality = item.FindControl("Nationality")
tbTelephone = item.FindControl("Telephone")
tbMobile = item.FindControl("Mobile")
tbEmail = item.FindControl("email")
tbFax = item.FindControl("Fax")
tbCourseID = item.FindControl("CourseID")
tbDateEnroled = item.FindControl("DateEnroled")
tbComment = item.FindControl("Comment")
Next

Dim UpdateDetails As New StudentDB
UpdateDetails.UpdateStudentDetails(StudentID, tbTitle.Text,
tbStatus.Text, tbSurname.Text, tbFirstname.Text, tbHouseNumber.Text,
tbStreet.Text, tbTown.Text, tbCounty.Text, tbCountry.Text, tbPostcode.Text,
tbDateOfBirth.Text, tbNationality.Text, tbTelephone.Text, tbMobile.Text,
tbEmail.Text, tbFax.Text, tbCourseID.Text, tbDateEnroled.Text, tbComment.Text)
BindViewPanel()
End If
End Sub

</script>

Can someone please help me.
 
H

Henrique Mello

You using uncompiled .Net right?
Try to rebind on the event, may be the ViewState is not been hold
 
G

Guest

Thanks Herique, i don't understand what u mean by uncompiled.net. i try
rebind on the event but it seems the same
 
H

Henrique Mello

Uncompiled ASP.NET is when you dont use the compiler to generate a .dll
with the aspx.cs(vb) files.

You tryed to put a Response.Write on the event to see if the problem is
not with the event it self?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top