well for this purpose we need to have a function that fetches the required information from the database tables and then we need views where we can actually execute the function to bring the required records.
=======function (used to access user profile property values)
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[fn_GetProfilePropertyValue]
(
@UserID as Int,
@ProfilePropertyName AS NVARCHAR(100)
)
RETURNS NVARCHAR(4000)
AS
BEGIN
DECLARE @PPValue NVARCHAR(4000)
-- If input is invalid, return null.
IF @UserID IS NULL
OR LEN(@UserID) = 0
OR @ProfilePropertyName IS NULL
OR LEN(@ProfilePropertyName) = 0
RETURN NULL
SELECT @PPValue = dbo.UserProfile.PropertyValue
FROM
dbo.ProfilePropertyDefinition INNER JOIN
dbo.UserProfile ON dbo.ProfilePropertyDefinition.PropertyDefinitionID = dbo.UserProfile.PropertyDefinitionID
WHERE (dbo.ProfilePropertyDefinition.PropertyName = @ProfilePropertyName) AND (dbo.UserProfile.UserID = @UserID)
Return @PPValue
END
===================================================
View (where the above mentioned function is used to get the required information)
SELECT dbo.Users.UserID, dbo.Users.Username, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'FirstName') AS FirstName, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'LastName') AS LastName, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'Company') AS Company, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'MyPhoto') AS MyPhoto, dbo.Users.Email, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'Telephone') AS Telephone, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'Street') AS Street, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'City') AS City, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'PostalCode') AS PostalCode, dbo.fn_GetProfilePropertyValue(dbo.Users.UserID, N'Country') AS CountryFROM dbo.Users INNER JOIN dbo.vuRSA ON dbo.vuRSA.UserID = dbo.Users.UserID
My projects update, help and trouble shooting with PHP, ASP.net, vb.net code snippets, SQLserver and mysql database tips and queries Mobile applications and development.
Monday, January 26, 2009
fetching user profile information of aspnet users database in dotnetnuke
Conrolling/accessing detailview columns in asp.net and detailview parameters by navigate url
hi..this is the peice of code that actually fetches the information from specific columns/cells of detailview
Dim obj As New Valuation.ValuationController
Dim obj2 As New RSAInfo.RSAInfoController
Me.lblmessage.Text = obj.GetValuationUsers(Flat).Count
Me.DetailsView1.DataSource = obj2.GetValuationUsers(Flat)
Me.DetailsView1.DataBind()
' in below code the test variable actually captures the data from 8th row and cell 1
test = Me.DetailsView1.Rows(8).Cells(1).Text.ToString
' this is how we hide rows of a detail view
Me.DetailsView1.Rows(4).Visible = False
Me.DetailsView1.Rows(5).Visible = False
Me.DetailsView1.Rows(6).Visible = False
Me.DetailsView1.Rows(7).Visible = False
Me.DetailsView1.Rows(8).Visible = False
and finally passing parameter from detailview through navigateurl
Me.HyperLink1.NavigateUrl = "http://localhost/dotnetnuke_2/khiz/khizer/rsaDetails/tabid/86/Default.aspx?uid=" & test
Dim obj As New Valuation.ValuationController
Dim obj2 As New RSAInfo.RSAInfoController
Me.lblmessage.Text = obj.GetValuationUsers(Flat).Count
Me.DetailsView1.DataSource = obj2.GetValuationUsers(Flat)
Me.DetailsView1.DataBind()
' in below code the test variable actually captures the data from 8th row and cell 1
test = Me.DetailsView1.Rows(8).Cells(1).Text.ToString
' this is how we hide rows of a detail view
Me.DetailsView1.Rows(4).Visible = False
Me.DetailsView1.Rows(5).Visible = False
Me.DetailsView1.Rows(6).Visible = False
Me.DetailsView1.Rows(7).Visible = False
Me.DetailsView1.Rows(8).Visible = False
and finally passing parameter from detailview through navigateurl
Me.HyperLink1.NavigateUrl = "http://localhost/dotnetnuke_2/khiz/khizer/rsaDetails/tabid/86/Default.aspx?uid=" & test
Labels:
accessing detailview data,
detailview,
navigateurl,
parameters
| Reactions: |
Subscribe to:
Posts (Atom)