You will find that in the SPContext class
SPList list = SPContext.Current.List; string listTitle = list.Title;
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spcontext.aspx
To parse the url you can use something like this
Vb.net
Private Function TryGetListName() As String If String.IsNullOrEmpty(Me.ListName) Then Dim path() As String = Me.Page.Request.Url.AbsolutePath.Trim("/"c).Split("/"c) Dim listName As String = String.Empty For i As Integer = 0 To path.Length - 1 If path(i).ToLower = "lists" Then If i < path.Length - 1 Then listName = path(i + 1) End If Exit For End If Next Return listName Else Return Me.ListName End If End Function
FROM#
private string TryGetListName() { if (string.IsNullOrEmpty(this.ListName)) { string[] path = this.Page.Request.Url.AbsolutePath.Trim('/').Split('/'); string listName = string.Empty; for (int i = 0; i <= path.Length - 1; i++) { if (path[i].ToLower() == "lists") { if (i < path.Length - 1) { listName = path[i + 1]; } break; } } return listName; } else { return this.ListName; } }
Good luck.
source share