DataSource Controls :: Fetching User Properties With Querystring With Function?

Feb 8, 2010

I found this function on [URL] It works great and I can get the properties and display them in separate binds. This is how I call the function, as shown In the link above

SELECT userid, username,
dbo.aspnet_Profile_GetProfile(userid, 'FirstName', DEFAULT) AS FirstName,
dbo.aspnet_Profile_GetProfile(userid, 'LastName', DEFAULT) AS LastName
FROM aspnet_users

However, i cant get it to work with a simple querystring...

<SelectParameters>
<asp:QueryStringParameter Name="username" QueryStringField="user" Type="String" />
</SelectParameters>

I want to fetch a users First and last name with a querystring, for example (default.aspx?user=DemoUser) But it doesn't work, it displays the latest entry in the aspnet_profile table. Btw, im trying to display it in a formview.

View 3 Replies


Similar Messages:

Security :: Any Asp_net Function For Accessing Profile Properties Of A User?

Dec 17, 2010

I am using my aspnet membership for storing user profile related information in the database and I am looking for a way to access that information out of database from a function like Member.GetProfile. I am just wondering of any of the membership classes give thet functionality that I can actually access the information out of Membership database.

Somebody suggested me follwowing thread:

[Code]....

I am "Profile" object is not recognized in my code I think they are trying to refer to some some instance of a class here by the word Profile but I am not sure what instance is that.

View 2 Replies

DataSource Controls :: Call Sql User Defined Function?

Feb 13, 2010

i have created a function to call username to pass user id as pararameter,

how to call userdefined function in asp.net

here is my function in sql

CREATE FUNCTION getusername
( @userid bigint )
RETURNS table
AS
RETURN (
SELECT login_id
FROM mst_useraccount
WHERE user_key =@userid
)
go

View 3 Replies

User Controls :: Redirect To Page After Fetching Its URL From Database

Jun 17, 2013

I have House_info Table in database

Id Name Behcode Password T_name

1 Sara 1111 1212 Store
2 Jack 2222 4545 Estate

and I have Admin.aspx page in this page I have EnterBTN Button and 2 Textbox  TxtBeh and TxtPass  here users enter Behcode and Password and when they click on EnterBTN Button it go to other page below is EnterBTN Event code

protected void EnterBTN_Click(object sender, ImageClickEventArgs e)
{
string data = Server.UrlEncode(Txtbeh.Text);
SqlCommand _cmd = new SqlCommand("EnterStore", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();

[code]....

here if users enter correct Behcode and password it go to Manager.aspx page...I want if users enter correct behcode and password if their T_name was =Store it go to Manager.aspx page And if their T_name was  Estate it go to Estate.aspx page.

View 1 Replies

Web Forms :: How To Add User Controls And Then Set Their Properties From A 'master' Page Which Hosts The User Controls

Jul 19, 2010

I am new to asp development but have been around c# for a while. Basically I am trying to create a page which will pull data from a database and then for each object it creates I would like to add a user control which is built to represent that object. So basically I have tried quite a number of things to get it to work but for some reason I can't figure it out! How can I programmably add user controls and then set their properties from a 'master' page which hosts the user controls?

View 3 Replies

DataSource Controls :: How To Use Cursor In Recursive Sql Function (scalar-value Function)

Apr 25, 2010

how can i use cursor in this function ?

ALTER FUNCTION [dbo].[GetCatIDChilds]

(

@CatID [code].....

View 1 Replies

SQL Server :: Fetching Role From Aspnet_Roles.RoleName For Appropriate User?

Mar 2, 2011

I have started learning ASP.net and SQL on and off the past month. I'm trying to make it so that when I select a user from a drop down box (SELECT [UserName], [UserId] FROM [vw_aspnet_Users]) that a label will then display the role next to the selected user. Just in case there is a better way to do it I want it so that the drop down selects the user, the label is just there to provide additional verification that it is the correct user and their current status (admin, moderator, user).

I then want to provide edit and delete buttons (but thats another story!)

I did think something like (SELECT aspnet_Roles.RoleName FROM aspnet_Roles WHERE aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId) would work but it produces an error.

View 2 Replies

Active Directory/LDAP :: Fetching The Currently Logged In User Email

Feb 3, 2010

I am using the System.DirectoryServices.UserPrincipal.Current.EmailAddress to fetch the Currently logged in users email from AD.If debug my sol am getting the Exact mail id of that Particular user for ex:john@in.domain.com.If i host My Application on iisAnd Access my App am getting some other Email id instead of the john@in.domain.com.I have changed the Application Pool identity to NetWorkService.

View 1 Replies

DataSource Controls :: ObjectDataSource Binding To Querystring When Don't Want It To?

Sep 23, 2010

I have an ODS control populating a Telerik grid. The ODS definition is pretty simple. It's set to call a method on a static class that has one parameter (entityID). I set this parameter in the OnSelecting event. When I test this, the world is a happy place and all is fine.

Then, I pass a query string to the page (which sets various unrelated values for the page, we'll say parameters X and Y). The page call's Telerik's radgrid.Rebind() event. When this happens, an error is throw from the ODS saying that the underlying method (the static data procedure) does not support parameters X and Y.

So, why is ODS thinking it should be using any querystring values at all when I have explicitly set the entityID parameter (of type Asp:Parameter)? How do I stop this from happening?

The Html:

[Code]....

The OnSelecting:

[Code]....

I see this odsList_OnSelecting being hit and the inspection of e.InputParameters only contains my expected single entry.

View 4 Replies

DataSource Controls :: Unable To Use Querystring In SQL Query

Apr 19, 2010

I'm passing on two Querystrings "ddl2" and "ddl3" onto an aspx page. At this page I'm running a SQL Query which has a WHERE clause in it that SHOULD use both the querystrings but only one of the two QS works at a time. When I use only "ddl2" OR only "dd3" in the WHERE clause the result is shown but not when both the Querystrings are used.

Below is the link to the page i get where I use the two QS's.

~/Option1_result.aspx?ddl2=722&%20ddl3=CA

Below is my SQL code:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Inventory_DBConnectionString3 %>"
SelectCommand="SELECT * FROM [CA] WHERE (([LATA] = @LATA) AND ([State] = @State))">
<SelectParameters>
<asp:QueryStringParameter Name="LATA" QueryStringField="ddl2" Type="Int16" />
<asp:QueryStringParameter Name="State" QueryStringField="ddl3" Type="String" />
</SelectParameters>
</asp:SqlDataSource>

View 2 Replies

DataSource Controls :: Querystring And Dropdowns With Autopostback?

Mar 5, 2011

I have a small problem with a querystring that populates 4 dropdowns.

On page A I have a hyperlink that adds 4 values to my url and on page B I have 4 dropdowns. I am able to click the link and the dropdowns are populated with the correct data! My problem is I do not know how to fire the postback event from DDL4 that shows my data!

[Code]....

My Sql statement:

[Code]....

As you can see from my code there are 2 control parameters. When DDLPrice is selected my page shows all the data. But when I use the querystring method it does not.

I load the querystring from my page load event

[Code]....

View 2 Replies

DataSource Controls :: QueryString Parameter Not Working?

Jun 29, 2010

this has to be a simple thing but I am missing it

here's what i have

the null condition and query works

the not null condition does not

I have tried:

ImageID=@id error myust declare @id
ImageID=id invalid column id
ImageID=?id incorrect syntax at ?
all errors occur at SqlDataReader Dr = Cmd.ExecuteReader();
int id = Convert.ToInt32(Request.QueryString["id"]);
string SQLquery ="";
if (id == null)
{
SQLquery = "Select Top 1 ImageData,ImageType from WebBGImages ORDER BY NEWID()";
}
else
{
SQLquery = "Select ImageData,ImageType from WebBGImages where ImageID=@id";
}
SqlCommand Cmd = new SqlCommand(SQLquery, connection);
SqlDataReader Dr = Cmd.ExecuteReader();

View 1 Replies

DataSource Controls :: Select All If Querystring Is Not Present?

Jun 8, 2010

I have a simple page that will display data from a particular category, using a querystring to filter my data in my sql select statement.

However, I would like to show all my data if there is no querystring present. Is there a simple way to do this?

View 6 Replies

DataSource Controls :: Insert Row Using Guid From Querystring?

Apr 2, 2010

I have a page with a gridview that is populated depending upon the value of the querystring passed to it - there is a one-to-many relationship between Jobs and Locations respectively (one job can have many locations), and the gridview is a list of Locations that are associated with a particular Job. So far so good.

I have a DetailsView below whose DefaultMode is Insert to add a new location, though I can't seem to capture the JobId (guid) from the querystring. I've tried the following code on the Datasource's Inserting event:

[Code]....

but on both occasions I get the same error: Foreign Key constraint broken on JobId field. It seems that the querystring is not being passed to the datasource for inclusion in the insert.

View 2 Replies

Web Forms :: Access User Controls Properties?

Jan 21, 2010

I have put a user control on my default page. The user control contains a label and a textbox. When I am trying to access the user control from the default page in the codebehind it says

Object reference not set to an instance of an object. I am wanting to do something like this:

View 7 Replies

DataSource Controls :: Request.querystring In Select Parameters?

Aug 7, 2010

I need to get a querystring in a select parameter

datasource.selectparameters.add("PostId", request.querystring("PostId"))

Something like that...but...i cant get the snytax right.

View 3 Replies

DataSource Controls :: Pass Value In Querystring To Stored Procedure?

Feb 7, 2010

.cs code is

[Code]....

and .aspx code is

[Code]....

now i want to pass value in Reply.aspx?C={0} to stored procedure

View 3 Replies

DataSource Controls :: Double Insert Method For A QueryString?

Apr 23, 2010

I have an SQLSiteMapProvider that needs a unique URL and have not got the smarts to work out how to get the provider to do the work so for now I thought I would just add the data to the DB then edit the URL with the ID. I can't do this on the first insert as I do not know the ID as it is an auto generated Primary Key

I tried to us the PostBackURL to go to a 2nd Page that got the New ID and added it to the end of the already known URL "Page.aspx?ID=" but apparently you can't do that as I found out (This would have been a masive hack to the problem I know but it would have got around it issue of for now)

this is how I guessed it would work

Insert Data with URL "Page.aspx?ID=" and more data.... Then Get New ID and update URL to have the ID on the end ie: Page.aspx?ID=99

View 7 Replies

Accessing A Class Properties In Function?

Apr 15, 2010

I am unsure of how to reference the properties of my class in a function. Here is how I see it in my head, but how do i go about this?

WebService.vb

[Code]....

UserClasses.vb

[Code]....

View 4 Replies

DataSource Controls :: Need To Set Properties On Run Time Created Control?

Dec 29, 2010

I have datasources being created in the code behind, and I am using an int for the name like:

i=1
createdatasource
datasource(i)
i=i+1
next

How do I define properties on a dynamic control like that?

datasource(convert.tostring(i)).connectionstring = "xx"

that will not work, how do I set properties on a dynamic control?

View 3 Replies

DataSource Controls :: Retrieving Properties Of Anonymous Type?

Apr 12, 2010

Usual situation: DataList and LinqDataSource with anonymous types...

Is there any way besides reflection to retrieve properties of anonymous typed DataItem in DataList_ItemDataBound event?

View 2 Replies

DataSource Controls :: Setting Common Properties For An ObjectDataSource?

Nov 7, 2010

In my ASP.NET application I am using a lot of ObjectDataSource controls. I want to set the following three properties globally for all ObjectDataSource controls:

EnableCaching="true"

View 5 Replies

DataSource Controls :: Pass QueryString In SelectCommand From Code Front?

Jan 7, 2011

I have a question related to <asp:SqlDataSource's SelectCommand. How to pass a querystring like <%# Eval("PhotoID") %> in the selectCommand. The whole frontend code is attached. I put

<%# Eval("PhotoID") %> and the photoid gets printed in the page.
<%# Eval("PhotoID") %> is the current displayed picture's PhotoID.

I want to pass this PhotoID or I want to pass <%# Eval("PhotoID") %> to the select command dynamically. I have tried the following approaches:

1) <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:aspnetdb %>" SelectCommand="SELECT UserName, commentDesc, uID FROM photo_comment_view Where pID = @pID"> <SelectParameters><asp:Parameter Name="pID" DefaultValue="7" /></SelectParameters> </asp:SqlDataSource> The above works but it gives only information about PhotoID 7, but there are other photos; How to set pID's value to <%# Eval("PhotoID") %> in ASP .NET's frontend page? then I also tried,

2) <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:aspnetdb %>" SelectCommand="SELECT UserName, commentDesc, uID FROM photo_comment_view Where pID = <%#'Eval("PhotoID') %>"></asp:SqlDataSource> Gives Parser error: Parser Error Message: The server tag is not well formed.

What I should do so that I can pass current PhotoID to SelectCommand? The frontend code:

<%@ Page Language="VB" MasterPageFile="~/Default.master" Title="Your Name Here | Picture Details"
CodeFile="Details.aspx.vb" Inherits="Details_aspx" %>
<asp:content id="Content1" contentplaceholderid="Main" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div class="shim solid"></div>
<div class="page" id="details">
<%--Update Panel Here--%>
<asp:UpdatePanel runat="server" ID="updatepanel">
<ContentTemplate>
<asp:formview id="FormView1" runat="server" datasourceid="ObjectDataSource1" cssclass="view"
borderstyle="none" borderwidth="0" CellPadding="0" cellspacing="0" EnableViewState="false" AllowPaging="true">
<itemtemplate>
<div class="buttonbar buttonbar-top">
<a href="Albums.aspx"><asp:image ID="Image1" runat="Server" skinid="gallery" /></a>
<asp:ImageButton ID="ImageButton9" Runat="server" CommandName="Page" CommandArgument="First" skinid="first"/>
<asp:ImageButton ID="ImageButton10" Runat="server" CommandName="Page" CommandArgument="Prev" skinid="prev"/>
<asp:ImageButton ID="ImageButton11" Runat="server" CommandName="Page" CommandArgument="Next" skinid="next"/>.................

View 14 Replies

DataSource Controls :: Querystring Or Control Parameter In Sqldatasource Binding

Jan 21, 2010

after I pass querystring parameter to page,page works as expected,but after that when I change my control parameter(dropdownlist selected value how can I set querystring to null or empty...

View 1 Replies

DataSource Controls :: Modify Column Properties In SQL Server 2008?

May 17, 2010

I create a table in SQL server 2008 and add some colume

after sometime i need to change some properties of colume

but problem come when saveing the table. Error message shown:-

Saving changes are not permitted.the changes you have made required the table to be droped and re-created .you have either made changes to a table that can't be re-created or enabled the option prevent saving changes that required the table to be re-created.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved