C# - How To GetProfile By Custom Properties
Mar 9, 2011
<profile enabled="true" automaticSaveEnabled="false">
<properties>
<add name="InvitationCode" type="String"/>
</properties>
</profile>
How to get profiles with InvitationCode="foo"? Also can i make property unique?
View 1 Replies
Similar Messages:
Jun 1, 2010
I have made a composite control that has 1 Label Control ,1 TextBox ,1 button and 1 Panel Control. Below is my code:
namespace ServerControl1
{
[
AspNetHostingPermission(SecurityAction.Demand,[code]....
The above code compiles without any error. Also I can drag and drop this control from the Toolbox of my Project on my web form. However I am unable the change the value of my fromLabel control.It allows me to change the value in the properties window.But when I run the form it always shows me its default value which is "From". I want it to be flexible so that any one can change the value in the properties window.
View 3 Replies
Mar 5, 2010
Why custom Gridview control not render html properlies under <Columns> properly in Visual Studio 2005?
For example:
[code]....
View 1 Replies
Mar 4, 2010
I have a custom control which inherit from the Table class and in the constructor, it takes a an integer as an argument. There is no empty constructor.
Is there a way for the user to set that variable in the properties window after they drag the control onto a form.
I know some .NET controls, you can set the source for the parameter to different things like another control's property, QueryString using just the properties window.
Right now, I have to create the control dynamically. I read the query string and then created the object.
View 1 Replies
Dec 6, 2010
I have the following property:
[Code]....
I want to be able to have the user see the available options when they try to do something such as DateRange = .... (i want intelllisense in here and I can set the values). Is this a possible functionality? I am using VS 2008 .NET 3.5
View 1 Replies
Aug 16, 2010
How do I get access to my custom strong-named properties of the common profile (page.profile) in ASP.NET for a classes that does not derive from page? I thought I could just pass in httpcontext.profile but I'm missing the custom properties.
There should be some class type that I can pass in? It appears the class type is ProfileCommon and is auto-generated.
View 1 Replies
Apr 20, 2010
I though it would be very simple but I can not get it today.I have a user control, with a grid control contained in it.
public Unit Width
{
get
[code]...
View 1 Replies
Nov 29, 2010
I'd like to add some custom instance properties to an ASP.Net User object. for example, I'd like to log every user's login and have something like: User.LoginTimes or calculate the User Profile's Completion percentage and be able to access it like: User.ProfileInfoPercentage, etc.
Now What I'd like to know is what would be the best approach to do this?
Forget about user instances? (e.g. define a database table with userid and ProfilePercentage info and retrieve data from profile like: DB.GetProfilePercentage(Context.Current.User.UserID) )
Override the ASP.Net User class and add my own functionalities.
Use Extension methods for the user class.
View 1 Replies
Jan 25, 2010
How can I add custom properties into control objects in ExtJs.
For example :
[code]....
This control comes from server dynamically and I want to write my custom property as well like below :
[code]....
I tried it but it said undefined. Normally since JavaScript is loose, I can easily modify objects but in this case it wouldn't work the way I expected.
View 1 Replies
Dec 14, 2010
The First - LblTextBox:
A label and textbox that have a LabelText field that can be set to change the label text
The Second - LoginCtl:
A login control that has two instances of LblTextBox for user name, password and a submit button
I want to control the tag rendering of these controls for formatting so I am not overriding CreateChildControls() to get the job done.
My issue is that the controls are rendered but none of the OnInit() code in either controls takes hold (blank labels, css styles not applied, etc..).
[Code]....
View 2 Replies
Feb 10, 2010
I want to build a custom validator control that inherits from BaseValidator. It will only be used on textboxes in my asp.net application. How can I get access to the textbox itself (read properties of the textbox) within the custom validator?
Here is what I have in my EvaluateIsValid function:
Dim t As TextBox = CType(Page.FindControl(Me.ControlToValidate), TextBox)
Return t.Text.Length <= t.MaxLength
It can't seem to find the control, so it breaks with a null reference exception. Can I do this another way?
View 1 Replies
Mar 25, 2010
I am trying to make an asp.net website using Visual web dev and C# that accesses data in an SQL database. For my site, I need to be able to save and access additional user properties such as age and gender. I have been playing around with the built in .NET Login tools but I don't understand how to keep track of the additional properties (age, gender...) I could store all the users information in my own database but how do I correlate the users data in my DB to the usernames in the member database that is automatically created?
View 2 Replies
Mar 5, 2010
We have added some custom profile properties to the web.config - what we want to do is have the code access them once (when user logs in) and cache this so that the code doesn't have to hit the database each time we call Profile.<our custom profile property name>
What we see is a call to GetProperties or GetProfile each time we access Profile. <our custom profile property name> - whats the recommended way to do this?
View 4 Replies
Jan 28, 2010
What is the best and most efficient way to set custom ASP.Net Calendar day properties from sql Database records? Each existing record has date column that corrosponds with calendar's date.
Can this be done without writing a custom server control?
View 5 Replies
Jan 19, 2010
we are working on some utilities to provide the webmaster, one of which needs to search the properties of the webparts on a page for certain string values. So I want to desterilize the blob into the object graph and
iterate through the properties.
View 1 Replies
Jun 5, 2010
how to use custom web server in asp.net application properties.
we can see in a web application properties, there are three options under servers
1. use visual studio development server
2. use local iis web server and
3. use custom web server
View 1 Replies
Dec 20, 2010
I am working on a project where we want to keep a history of a particular object. On save I want a method on the object that will determine if it has changed so that I can call a method to save its current state to history. E.g. I populate a form from an object the user makes changes (or possibly not) and submits the from. I want to take my original object and a copy of that object that has been updated from the form and determine if it has changed at all. Additionally I may decide at some point that certain properties don't matter (e.g. if Name changes I won't track it).
I'm thinking the easiest/most flexible way to accomplish this would be if I could give the properties I care about a custom attribute [ChangeTracked] and then I could use reflection to get a list of all properties with that attribute and loop through them comparing A.property == B.property to determine if any have changed.
Would this work? Is there a significantly better/easier way to handle this, like some sort of built in method you can add to an object to determine if the values of any properties have changed? Whatever the solution some psudo code would be appreciated. Just as a point of clarification the solution needs to determine if the value I care about has actually changed not just if it has been assigned since it was created i.e. if I set Name="bob" and it was already "bob" before my assignment this does not count as a change.
View 2 Replies
Mar 19, 2010
We've been using the custom SQL table profile provider offered on the MSDN site.No problem configuring the new provider and saving profile values into our custom table while using the Create User Wizard.However, we cannot seem to be able to display the profile properties, using
[Code]....
The user is logged in, and there are no problems displaying all membership values and role values.
View 1 Replies
Sep 15, 2010
With following code, I can fetch all properties of user control. I need to get only those properties which were separately defined excluding the default ones.
[Code]....
View 2 Replies
Dec 30, 2010
I have created a control with two standard asp controls in (a label and a Textbox).I want to have access to the controls within but also be available from the designer so that the label properties can be prefixed with Label_ etc for example
[Code]....
How can I create a property from this reflection list?
<Bowyer:FormTextbox runat="server" ID="FormTextbox2" required="True"/>[Code]....
View 3 Replies
Jul 12, 2010
I'm using DotNetOpenAuth as my membership system, and the way I have it working now seems to be working quite well. What I'd like to do however is build into my website the ability to check user credentials against the AuthCookie rather than a session. In the membership provider, I can check for the username like this
string UserName = System.Web.HttpContext.Current.User.Identity.Name;
''# which returns the OpenId ClaimedIdentifier
What I'm wondering is if there is a way to extend this so that I can retrieve custom properties from the AuthCookie rather than having to create my own session object. Currently I have this setup.
UserSessionModal
Namespace Domain
Public Class UserSessionModel
Public Property ID As Integer
Public Property RegionID As Integer
Public Property Username As String
Public Property Slug As String
Public Sub New(ByVal user As User)
_ID = user.ID
_RegionID = user.RegionID
_Username = user.UserName
_Slug = Replace(user.UserName, " ", "-")
End Sub
End Class
End Namespace
BaseController (inherited by all controllers)
Protected Overrides Function CreateActionInvoker() As System.Web.Mvc.IActionInvoker
''# Create a UserInfo object for the logged in user
''# and store it in a session state.
If Session("UserInfo") Is Nothing AndAlso User.Identity.IsAuthenticated Then
Dim user As Domain.UserSessionModel = New Domain.UserSessionModel(OpenIdService.GetOpenId(HttpContext.User.Identity.Name).User)
Session("UserInfo") = user
End If
Return MyBase.CreateActionInvoker()
End Function
Then in my views I do something like this
<%
Dim user As MyApp.Core.Domain.UserSessionModel = DirectCast(Session("UserInfo"), MyApp.Core.Domain.UserSessionModel)
%>
<%: Html.ActionLink(user.UserName, "Details", "Users", New With {.id = user.ID, .slug = user.Slug}, Nothing)%>
What I really need to be able to do is remove the Session stuff all together and just simply check the AuthCookie for my custom properties ID, RegionID, Username, and Slug. I can already get the "ClaimedIdentifier" out of the AuthCookie using HttpContext.User.Identity.Name... I just need to be able to extend it.
View 1 Replies
Feb 23, 2011
As a starting point for creating custom controls, I would like to make a control that simply displays a number. If we imagine the .ascx file contains nothing except for a literal control, and the code behind sets that value to 1.
I then want to be able to do myControl.increment();
This will run some javascript that increases the value of the literal control.
I could inject a javascript into the page, such as pseudocode:
page_load
{
scriptything.register("function increment(x) { $('#myLiteral').increment(); });
}
or something, but that wouldn't be myControl.increment, that would just be increment(). More than one control on the page would screw it up.
View 2 Replies
Jan 12, 2010
I am creating a web service that returns the list of states. How do I create an object in C# in the web service that will return multiple values (of properties of an object). Currently, the way I am doing it, it only returns the last value pulled from the database. Do I need store an array of properties?
[code]....
View 5 Replies
May 21, 2010
I've been working on this project for a few days now, and have been unable to resolve the issue of getting intellisense support for my custom-defined inner properties for a user control (ascx, mind you). I have seen the solution to this (using server controls, .cs mind you) many times. Spelled out in this article very well. Everything works for me while using ascx controls except intellisense. Here's the outline of my code:
[PersistChildren(true)]
[ParseChildren(typeof(BreadCrumbItem))]
[ControlBuilder(typeof(BreadCrumbItem))]
public partial class styledcontrols_buttons_BreadCrumb : System.Web.UI.UserControl
{
...
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public List<BreadCrumbItem> BreadCrumbItems
{
get { return _breadCrumbItems; }
set { _breadCrumbItems = value; }
}
...
protected override void AddParsedSubObject(object obj)
{
base.AddParsedSubObject(obj);
if (obj is BreadCrumbItem)
BreadCrumbItems.Add(obj as BreadCrumbItem);
}
...
public class BreadCrumbItem : ControlBuilder
{
public string Text { get; set; }
public string NavigateURL { get; set; }
public override Type GetChildControlType(string tagName, System.Collections.IDictionary attribs)
{
if (String.Compare(tagName, "BreadCrumbItem", true) == 0)
{
return typeof(BreadCrumbItem);
}
return null;
}
}
}
Here's my mark up (which works fine, just no intellisense on the child object declarations):
<%@ Register src="../styledcontrols/buttons/BreadCrumb.ascx" tagname="BreadCrumb" tagprefix="uc1" %>
...
<uc1:BreadCrumb ID="BreadCrumb1" runat="server" BreadCrumbTitleText="Current Page">
<BreadCrumbItem Text="Home Page" NavigateURL="~/test/breadcrumbtest.aspx?iwentsomewhere=1" />
<BreadCrumbItem Text="Secondary Page" NavigateURL="~/test/breadcrumbtest.aspx?iwentsomewhere=1" />
</uc1:BreadCrumb>
I think the issue lies with how the intellisense engine traverses supporting classes. All the working examples I see of this are not ascx, but Web Server Controls (cs, in a compiled assembly).
View 1 Replies
May 12, 2010
I've a requirement where i need to pass some objects across the pages. So i created a custom class with all the properties required and created a instance of it and assigned all the properties appropriately. I then put that object in the session and took it the other page. The problem is that even when i set the properties values to the class it is coming as null. I set a breakpoint in the getter-setter and saw that the value itself is coming as null.
public class GetDataSetForReports
{
private Table m_aspTable;
private int m_reportID;
private string m_accountKey;
private string m_siteKey;
private string m_imUserName;
/// <summary>
/// Asp Table containing the filters
/// </summary>
public Table aspTable
{
get
{
return m_aspTable;
}
set
{
m_aspTable = aspTable;
}
}
/// <summary>
/// Report ID
/// </summary>
public int reportID
{
get
{
return m_reportID;
}
set
{
m_reportID = reportID;
}
}
/// <summary>
/// All the accounts selected
/// </summary>
public string accountKey
{
get
{
return m_accountKey;
}
set
{
m_accountKey = accountKey;
}
}
/// <summary>
/// All the sites selected
/// </summary>
public string siteKey
{
get
{
return m_siteKey;
}
set
{
m_siteKey = siteKey;
}
}
/// <summary>
/// Current User Name
/// </summary>
public string imUserName
{
get
{
return m_imUserName;
}
set
{
m_imUserName = imUserName;
}
}
}
This is how i'm creating an instance in the page1 and trying to get it in the page2. Page1 Code
//Add the objects to the GetDataSetForReports Class
GetDataSetForReports oGetDSForReports = new GetDataSetForReports();
oGetDSForReports.aspTable = aspTable;
oGetDSForReports.reportID = iReportID;
oGetDSForReports.accountKey = AccountKey;
oGetDSForReports.siteKey = Sitekey;
oGetDSForReports.imUserName = this.imUserName.ToString();
But the values are not getting set at all. The values are not passing to the class (to the setter) at all. Am i making any OOP blunder?
View 1 Replies