the first page is default.aspx.vb, and the second is userpage.aspx.vb
In the first one, I have a login system.
If the login is correct, it redirect the user to userpage.aspx.vb
If the login is incorrect, it shows a msgbox saying "go away" and stays in default.aspx.vb.
My code so far:
Code:
Protected Sub cmdLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
Dim customers As Northwind.CustomersDataTable = customersAdapter.GetLogin(txtUsername.Text, txtPassword.Text)
If customers.Count = 1 Then
---------- Go to userpage.aspx.vb -------------
Else
MsgBox("Go away!", MsgBoxStyle.Critical, "You aren't registred!")
End If
End Sub
yes I'm using that I´ve searched for session variables and came up with this:
Code:
Dim customers As Northwind.CustomersDataTable = customersAdapter.GetLogin(txtUsername.Text, txtPassword.Text)
If customers.Count = 1 Then
response.redirect("userpage.aspx")
me.session("test") = customers(0).customerID
Else
MsgBox("Go away!", MsgBoxStyle.Critical, "You aren't registred!")
End If
In Page userpage.aspx:
Private Function EvaluateValue() As String
If Session("test") Is Nothing Then
Return "Empty"
Else
Return Session("test").ToString()
End If
End Function
It won't work. First you redirect, then attempt to set a session. Response.Redirect essentially stops page execution, so the session shouldn't get set. Set the session first, then redirect.
Oh I see, you don't know players like Ricardo Quaresma, Pepe, Adriano, Helton, Raul Meireles, Anderson, Lucho Gonzales, Lisandro Lopez, Postiga... and so on...
I have a gridview that is binded with a table adapter and works fine except with the dates!
For example, in CreationDate the field apears like this:
22/03/06 - 00:00:00
This Creation date is a field of an access database. This field is Date/Time but in format it is Abreviate Date.
What Can I do to take the time off?
My code:
Code:
Dim ServicoAdapter As New GestFacturasTableAdapters.ServicosClienteTableAdapter
Dim rsSecl As GestFacturas.ServicosClienteDataTable = ServicoAdapter.GetServicosdoCliente(userID)
GridView1.DataSource = rsSecl
GridView1.DataBind()
Handle the Gridview's RowDataBound event. You can access all the cells of each row everytime the event is raised. In it, you can handle the value displayed in the cell that contains the date, and format it using String.Format()
String.Format takes format specifiers, a list of which is here.
I mess with you because it's fun to prod soccer fans.
Listen I've searched for rowdatabound and I developed this code:
Code:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
e.Row.Cells(6).Text = Format(e.Row.Cells(2).Text, "DD/MM/YYYY")
End Sub
You can see in the Attachment the result...
It was not what I expected. The collumn nº3 is also a date collumn.
Note that it also changed the title of the collumn
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.Cells(6).Text <> "Dt Inicio" Then
e.Row.Cells(6).Text = String.Format("{d}", e.Row.Cells(6).Text)
End If
End Sub
"Dt Inicio" is the name of the collumn.
The result is:
System.FormatException was unhandled by user code.
I develop code in vb. I wonder if this String.format is only for C#...
This still isn't working... I don't know what to do next...
Code:
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.Cells(6).Text <> "Dt Inicio" Then
e.Row.Cells(6).Text = String.Format("{0:dd/MM/yyyy}", e.Row.Cells(6).Text)
End If
If e.Row.Cells(7).Text <> "Dt Expira" Then
e.Row.Cells(7).Text = String.Format("{0:dd/MM/yyyy}", e.Row.Cells(7).Text)
End If
End Sub
I will try to remember that about FC Porto. For me, the best club in the world is one of those used by the Neanderthals to beat their enemies to death.