 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 3rd, 2005, 05:23 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Editable datagrid Data Disappears on Postback
I have an asp.net page which contains three editable Datagrids. I read the "An Extensive Examination of the Datagrid Web Control: Part 6" to figure out how to do it. I created a page with one datagrid, and when that worked, I added the other 2 and copied my previous code.
My Problem is like this. When I click on the edit button for a datagrid, the data for that datagrid disappears (the header row remains).
I was told that when I postback (i.e. press any buttons) I need to rebind all three datagrids.
When I tried calling the BindData() SubRoutine (like in the article) for all three datagrids, on each event, the only thing that happened was that instead of data from one datagrid disappearing, it disappeared from all three datagrids.
The next thing i tried was just calling dg1.databind() dg2.databind() dg3.databind() from each eventhandler. When I tried that instead of just the data disapearing, the entire datagrid disappeared (header row and all).
The following is one of my BindData() subroutines, as well as on of the EditDatagrid Subroutines.
Code:
Sub BindData()
Dim emailValue As String = Email.Text
'1. Create a connection
Const strConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=*****"
Dim objConn As New System.Data.OleDb.OleDbConnection(strConnStr)
objConn.Open()
'2. Create a command object for the query
Const strSQL As String = "SELECT * FROM [Event] WHERE [Event].[Email] = @Email"
Dim objCmd As New System.Data.OleDb.OleDbCommand(strSQL, objConn)
Dim parameterEmail As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Email", System.Data.OleDb.OleDbType.VarWChar)
parameterEmail.Value = emailValue
objCmd.Parameters.Add(parameterEmail)
'3. Create/Populate the DataReader
Dim objDR As System.Data.OleDb.OleDbDataReader
objDR = objCmd.ExecuteReader()
DG1.DataSource = objDR
DG1.DataBind()
End Sub
Sub EditDG1(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG1.EditItemIndex = e.Item.ItemIndex
BindData()
BindData2()
BindData3()
End Sub
I think there must be something wrong with my BindData() Sub, but for the life of me I can not figure it out.
Any help would be greatly appreciated.
Thanks in advance,
Adir
|
|

February 4th, 2005, 07:02 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quote:
|
quote:My Problem is like this. When I click on the edit button for a datagrid, the data for that datagrid disappears (the header row remains).
|
you should enable ViewState for your grid
Quote:
|
quote:I was told that when I postback (i.e. press any buttons) I need to rebind all three datagrids.
|
incorrect,if you enable ViewState and you won't want to change the sate of the grid you won't need to rebind the grid in every post back,
Quote:
|
quote:The next thing i tried was just calling dg1.databind() dg2.databind() dg3.databind() from each eventhandler. When I tried that instead of just the data disapearing, the entire datagrid disappeared (header row and all).
|
because here you bind your grid without setting its DataSource property so there is nothing for showing on your page,
ViewSate property keeps the persistence of your Html tags(your grid converting to table tags) between multi postbacks,if you enable the ViewState property just when you want to change your grid,you should rebind it(rebinding means setting its DataSource property and binding your grid)if you're sure the grid is not going to be changed you don't need to rebind it in every postback,
also when you let the user edit your grid you should rebind the grid,
Code:
Sub EditDG1(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG1.EditItemIndex = e.Item.ItemIndex
BindGrid()
'BindGrid() fetchs fresh data from DB and assigns them to the DataSource property_
'and Binds the Grid(rebinding)
End Sub
HtH.
_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
|
|

February 4th, 2005, 09:39 AM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Thank you for your response.
How do I enable viewstate?
I thought that it was enabled by default?
Thanks,
Adir
|
|

February 4th, 2005, 12:27 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
yes,it's enabled by default,(I tried to look into your code IMO it doesn't have any problem,are you sure your query returns some rows?what BindData2 and BindData3 do?what is happening in your Page_Load?),
if you couldn't solve your problem post your complete code.
_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
|
|

February 4th, 2005, 12:57 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
Binddata2() and BindData3() are basically the same as BindData(), except that they bind data specific to their datagrids.
I am posting the complete code for the webpage.
Thank you,
Adir
Code:
<%@ Page Language="VB" %>
<script runat=server>
Sub page_load(ByVal sender As Object, ByVal e As EventArgs)
Dim receivedValue As String
receivedValue = CType(Context.Items("variableToPass"), String)
Email.Text = receivedValue
If Not Page.IsPostBack Then
BindData()
BindData2()
BindData3()
End If
End Sub
Sub BindData()
Dim emailValue As String = Email.Text
'1. Create a connection
Const strConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=****"
Dim objConn As New System.Data.OleDb.OleDbConnection(strConnStr)
objConn.Open()
'2. Create a command object for the query
Const strSQL As String = "SELECT * FROM [Event] WHERE [Event].[Email] = @Email"
Dim objCmd As New System.Data.OleDb.OleDbCommand(strSQL, objConn)
Dim parameterEmail As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Email", System.Data.OleDb.OleDbType.VarWChar)
parameterEmail.Value = emailValue
objCmd.Parameters.Add(parameterEmail)
'3. Create/Populate the DataReader
Dim objDR As System.Data.OleDb.OleDbDataReader
objDR = objCmd.ExecuteReader()
DG1.DataSource = objDR
DG1.DataBind()
End Sub
Sub EditDG1(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG1.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub
Sub CancelDG1(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG1.EditItemIndex = -1
BindData()
End Sub
Sub UpdateDG1(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
'Read in the values of the updated row
Dim EmailValue As String = Email.Text
Dim ID As String = e.Item.Cells(1).Text
Dim EName As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Dim FName As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Dim Lname As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
Dim City As String = CType(e.Item.Cells(5).Controls(0), TextBox).Text
Dim State As String = CType(e.Item.Cells(6).Controls(0), TextBox).Text
Dim ZipCode As String = CType(e.Item.Cells(7).Controls(0), TextBox).Text
'Construct the SQL statement using Parameters
Dim strSQL As String = _
"UPDATE [Event] " & _
"SET [ReminderName] = @EventName, [RecipFirstName] = @FirstName, " & _
"[RecipLastName] = @LastName, [RecipCity] = @City,[RecipState] = @State, [RecipZipCode] = @ZipCode " & _
"WHERE [EventID] = @ID"
Const strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=****"
Dim objConn As New Data.OleDb.OleDbConnection(strConnString)
objConn.Open()
Dim myCommand As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, objConn)
myCommand.CommandType = Data.CommandType.Text
' Add Parameters to the SQL query
Dim parameterEventName As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@EventName", System.Data.OleDb.OleDbType.VarWChar)
parameterEventName.Value = EName
myCommand.Parameters.Add(parameterEventName)
Dim parameterFirstName As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@FirstName", System.Data.OleDb.OleDbType.VarWChar)
parameterFirstName.Value = FName
myCommand.Parameters.Add(parameterFirstName)
Dim parameterLastName As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@LastName", System.Data.OleDb.OleDbType.VarWChar)
parameterLastName.Value = Lname
myCommand.Parameters.Add(parameterLastName)
Dim parameterCity As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@City", System.Data.OleDb.OleDbType.VarWChar)
parameterCity.Value = City
myCommand.Parameters.Add(parameterCity)
Dim parameterState As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@State", System.Data.OleDb.OleDbType.VarWChar)
parameterState.Value = State
myCommand.Parameters.Add(parameterState)
Dim parameterZipCode As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@ZipCode", System.Data.OleDb.OleDbType.VarWChar)
parameterZipCode.Value = ZipCode
myCommand.Parameters.Add(parameterZipCode)
Dim parameterEventID As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@ID", System.Data.OleDb.OleDbType.VarWChar)
parameterEventID.Value = ID
myCommand.Parameters.Add(parameterEventID)
myCommand.ExecuteNonQuery() 'Execute the UPDATE query
objConn.Close() 'Close the connection
'Finally, set the EditItemIndex to -1 and rebind the DataGrid
DG1.EditItemIndex = -1
BindData()
End Sub
Sub BindData2()
Dim emailValue As String = Email.Text
'1. Create a connection
Const strConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=****"
Dim objConn As New System.Data.OleDb.OleDbConnection(strConnStr)
objConn.Open()
'2. Create a command object for the query
Const strSQL As String = "SELECT * FROM [User] WHERE [User].[Email] = @Email"
Dim objCmd As New System.Data.OleDb.OleDbCommand(strSQL, objConn)
Dim parameterEmail As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Email", System.Data.OleDb.OleDbType.VarWChar)
parameterEmail.Value = emailValue
objCmd.Parameters.Add(parameterEmail)
'3. Create/Populate the DataReader
Dim objDR As System.Data.OleDb.OleDbDataReader
objDR = objCmd.ExecuteReader()
DG2.DataSource = objDR
DG2.DataBind()
End Sub
Sub EditDG2(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG2.EditItemIndex = e.Item.ItemIndex
BindData2()
End Sub
Sub CancelDG2(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG2.EditItemIndex = -1
BindData2()
End Sub
Sub UpdateDG2(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
'Read in the values of the updated row
'Dim EmailValue As String = Email.Text
Dim Email As String = e.Item.Cells(1).Text
Dim FName As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Dim LName As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Dim Zip As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
'Construct the SQL statement using Parameters
Dim strSQL As String = _
"UPDATE [User] " & _
"SET [FirstName] = @FirstName, [LastName] = @LastName, " & _
"[ZipCode] = @ZipCode " & _
"WHERE [Email] = @Email"
Const strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=*****"
Dim objConn As New Data.OleDb.OleDbConnection(strConnString)
objConn.Open()
Dim myCommand As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, objConn)
myCommand.CommandType = Data.CommandType.Text
' Add Parameters to the SQL query
Dim parameterFirstName As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@FirstName", System.Data.OleDb.OleDbType.VarWChar)
parameterFirstName.Value = FName
myCommand.Parameters.Add(parameterFirstName)
Dim parameterLastName As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@LastName", System.Data.OleDb.OleDbType.VarWChar)
parameterLastName.Value = Lname
myCommand.Parameters.Add(parameterLastName)
Dim parameterZipCode As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@ZipCode", System.Data.OleDb.OleDbType.VarWChar)
parameterZipCode.Value = Zip
myCommand.Parameters.Add(parameterZipCode)
Dim parameterEmail As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Email", System.Data.OleDb.OleDbType.VarWChar)
parameterEmail.Value = Email
myCommand.Parameters.Add(parameterEmail)
myCommand.ExecuteNonQuery() 'Execute the UPDATE query
objConn.Close() 'Close the connection
'Finally, set the EditItemIndex to -1 and rebind the DataGrid
DG2.EditItemIndex = -1
BindData2()
End Sub
Sub BindData3()
Dim emailValue As String = Email.Text
'1. Create a connection
Const strConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=****"
Dim objConn As New System.Data.OleDb.OleDbConnection(strConnStr)
objConn.Open()
'2. Create a command object for the query
Const strSQL As String = "SELECT * FROM [User] WHERE [User].[Email] = @Email"
Dim objCmd As New System.Data.OleDb.OleDbCommand(strSQL, objConn)
Dim parameterEmail As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Email", System.Data.OleDb.OleDbType.VarWChar)
parameterEmail.Value = emailValue
objCmd.Parameters.Add(parameterEmail)
'3. Create/Populate the DataReader
Dim objDR As System.Data.OleDb.OleDbDataReader
objDR = objCmd.ExecuteReader()
DG3.DataSource = objDR
DG3.DataBind()
End Sub
Sub EditDG3(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG3.EditItemIndex = e.Item.ItemIndex
BindData3()
End Sub
Sub CancelDG3(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
DG3.EditItemIndex = -1
BindData3()
End Sub
Sub UpdateDG3(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
'Read in the values of the updated row
Dim EmailValue As String = Email.Text
Dim Sports As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Dim Music As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Dim Restaurant As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
Dim Chocolate As String = CType(e.Item.Cells(5).Controls(0), TextBox).Text
Dim Flowers As String = CType(e.Item.Cells(6).Controls(0), TextBox).Text
Dim Jewelery As String = CType(e.Item.Cells(7).Controls(0), TextBox).Text
'Construct the SQL statement using Parameters
Dim strSQL As String = _
"UPDATE [User] " & _
"SET [SportEvent] = @Sports, [MusicEvent] = @Music, " & _
"[Restaurant] = @Restaurant, [Chocolate] = @Chocolate, [Flowers] = @Flowers, [Jewelry] = @Jewelery " & _
"WHERE [Email] = @Email"
Const strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=****"
Dim objConn As New Data.OleDb.OleDbConnection(strConnString)
objConn.Open()
Dim myCommand As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(strSQL, objConn)
myCommand.CommandType = Data.CommandType.Text
' Add Parameters to the SQL query
Dim parameterSports As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Sports", System.Data.OleDb.OleDbType.Boolean)
parameterSports.Value = Sports
myCommand.Parameters.Add(parameterSports)
Dim parameterMusic As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Music", System.Data.OleDb.OleDbType.Boolean)
parameterMusic.Value = Music
myCommand.Parameters.Add(parameterMusic)
Dim parameterRestaurant As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Restaurant", System.Data.OleDb.OleDbType.Boolean)
parameterRestaurant.Value = Restaurant
myCommand.Parameters.Add(parameterRestaurant)
Dim parameterChocolate As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Chocolate", System.Data.OleDb.OleDbType.Boolean)
parameterChocolate.Value = Chocolate
myCommand.Parameters.Add(parameterChocolate)
Dim parameterFlowers As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Flowers", System.Data.OleDb.OleDbType.Boolean)
parameterFlowers.Value = Flowers
myCommand.Parameters.Add(parameterFlowers)
Dim parameterJewelery As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Jewelery", System.Data.OleDb.OleDbType.Boolean)
parameterJewelery.Value = Jewelery
myCommand.Parameters.Add(parameterJewelery)
Dim parameterEmail As System.Data.OleDb.OleDbParameter = _
New System.Data.OleDb.OleDbParameter("@Email", System.Data.OleDb.OleDbType.VarWChar)
parameterEmail.Value = EmailValue
myCommand.Parameters.Add(parameterEmail)
myCommand.ExecuteNonQuery() 'Execute the UPDATE query
objConn.Close() 'Close the connection
'Finally, set the EditItemIndex to -1 and rebind the DataGrid
DG3.EditItemIndex = -1
BindData3()
End Sub
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<form id=form1 runat=server>
<table height="100%" width="100%">
<tr>
<td colspan="3" rowspan="3" align=center valign=top>
<table>
<tr>
<td colspan="3">
<asp:Label ID="Label1" Text="The following is the information we have registered"
Runat="server"></asp:Label>
</td>
</tr>
<tr>
<td colspan="3">
User Information:</td>
</tr>
<tr>
<td colspan="3">
<asp:DataGrid ID="DG2" Runat="server" AutoGenerateColumns="False" OnUpdateCommand="UpdateDG2" OnCancelCommand="CancelDG2" OnEditCommand="EditDG2">
<Columns>
<asp:EditCommandColumn ButtonType="PushButton" EditText="Edit" CancelText="Cancel"
UpdateText="Update"></asp:EditCommandColumn>
<asp:BoundColumn DataField="Email" HeaderText="Email"></asp:BoundColumn>
<asp:BoundColumn DataField="FirstName" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField="LastName" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField="ZipCode" HeaderText="Zip"></asp:BoundColumn>
</Columns>
<ItemStyle ForeColor="Fuchsia" Font-Names="Verdana" Font-Size="Medium" Font-Bold="True"
BackColor="White"></ItemStyle>
<HeaderStyle ForeColor="White" Font-Names="Verdana" Font-Size="Medium" Font-Bold="True"
BackColor="Fuchsia"></HeaderStyle>
</asp:DataGrid>
<asp:DataGrid ID="DG3" Runat="server" AutoGenerateColumns="False" OnUpdateCommand="UpdateDG3" OnCancelCommand="CancelDG3" OnEditCommand="EditDG3">
<Columns>
<asp:BoundColumn HeaderText="Subscriptions:"></asp:BoundColumn>
<asp:EditCommandColumn ButtonType="PushButton" EditText="Edit" CancelText="Cancel"
UpdateText="Update"></asp:EditCommandColumn>
<asp:BoundColumn DataField="SportEvent" HeaderText="Sports"></asp:BoundColumn>
<asp:BoundColumn DataField="MusicEvent" HeaderText="Music"></asp:BoundColumn>
<asp:BoundColumn DataField="Restaurant" HeaderText="Restaurant"></asp:BoundColumn>
<asp:BoundColumn DataField="Chocolate" HeaderText="Chocolate"></asp:BoundColumn>
<asp:BoundColumn DataField="Flowers" HeaderText="Flowers"></asp:BoundColumn>
<asp:BoundColumn DataField="Jewelry" HeaderText="Jewelery"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</td>
</tr>
<tr>
<td colspan="3">
Events:</td>
</tr>
<tr>
<td colspan="3">
<asp:DataGrid ID="DG1" Runat=server OnEditCommand="EditDG1" OnCancelCommand="CancelDG1" OnUpdateCommand="UpdateDG1" AutoGenerateColumns="False">
<Columns>
<asp:EditCommandColumn ButtonType="PushButton" EditText="Edit" CancelText="Cancel"
UpdateText="Update"></asp:EditCommandColumn>
<asp:BoundColumn DataField="EventID" HeaderText="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="ReminderName" HeaderText="Event Name"></asp:BoundColumn>
<asp:BoundColumn DataField="RecipFirstName" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField="RecipLastName" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField="RecipCity" HeaderText="City"></asp:BoundColumn>
<asp:BoundColumn DataField="RecipState" HeaderText="State"></asp:BoundColumn>
<asp:BoundColumn DataField="RecipZipCode" HeaderText="Zip Code"></asp:BoundColumn>
<asp:BoundColumn DataField="IdReminderType" HeaderText="Event Type" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="iDMonth" HeaderText="Month" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="Day" HeaderText="Day" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="Year" HeaderText="Year" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="IdFirstReminder" HeaderText="First Reminder" ReadOnly="True"></asp:BoundColumn>
<asp:BoundColumn DataField="IdSecReminder" HeaderText="Second Reminder" ReadOnly="True"></asp:BoundColumn>
</Columns>
<ItemStyle ForeColor="Black" Font-Names="Verdana" Font-Size="Medium" Font-Bold="True"
BackColor="Fuchsia"></ItemStyle>
<HeaderStyle ForeColor="Black" Font-Names="Verdana" Font-Size="Medium" Font-Bold="True"
BackColor="Fuchsia"></HeaderStyle>
<EditItemStyle BackColor="Yellow"></EditItemStyle>
</asp:DataGrid>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="Email" Runat="server" Visible="False"></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</tr>
<tr>
</tr>
</table>
</form>
</body>
</html>
|
|

February 4th, 2005, 02:08 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
|
|
your update and cancel method is right and works correctly,but I don't know about this two lines,
receivedValue = CType(Context.Items("variableToPass"), String)
SELECT * FROM [Event] WHERE [Event].[Email]...
make sure every time Email.Text has a valid value and also your source returns something.
_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.
|
|

February 4th, 2005, 02:52 PM
|
|
Registered User
|
|
Join Date: Feb 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You pinpointed the problem, I should have had those lines inside the If Not Page.ispostback then
end if
Thank you very much for all your help.
Adir
|
|
 |