C# - Change Login Control Layout In Custom Control?

Jun 21, 2010

Is it possible to create a Custom Control which inherits from System.Web.UI.WebControls.Login and change its layout and add additional controls such as a DropDownList. I have tried various ways to do this by overriding the Render Contents methods but each time I have to recreate the controls which are already present in the main Login control. Is it possible to somehow get a reference to the controls in the parent class and then override the Render Contents method to render the controls how I need them?I would like if at all possible to use the controls and functionality that already exist in the Login control but just change the layout and add in an additional DropDownList control.

View 1 Replies


Similar Messages:

Security ::change The Layout Of The Login Control?

Jul 14, 2010

Is there a way to change the layout of the login control so that it shows username and password side by side instead of the username on top of password?

View 2 Replies

C# - Change The Layout Of The CreateUserWizard Control?

Jan 1, 2011

How to change just the layout (template) of the CreateUserWizard control programmatically? I would to define another layout (not using the horrid table) but continue to use all the event handling and the creation of the user of the CreateUserWizard control. Just for reference, the following code doesn't work, and produces an unexpected result not representing my Template at all. The "InstantiateIn" method of the ITemplate is not called.

public partial class b : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
CreateUserWizard createUserWizard = new CreateUserWizard();
createUserWizard.CreateUserStep.ContentTemplate = new Template();
Panel1.Controls.Add(createUserWizard);
}
}
public class Template : ITemplate
{
void ITemplate.InstantiateIn(Control container)
{
container.Controls.Add(new TextBox() { ID = "UserName" });
container.Controls.Add(new TextBox() { ID = "Password" });
container.Controls.Add(new TextBox() { ID = "ConfirmPassword" });
container.Controls.Add(new TextBox() { ID = "Email" });
container.Controls.Add(new PlaceHolder() { ID = "ErrorMessage" });
}
}
}

View 1 Replies

Custom Server Controls :: Inherit The Logion Control UI In Ascx Login Control?

Mar 14, 2011

How can I inherit the logion control UI in my custom ascx login control as well override it's OnAuthenticate event in my cusotm control code.

View 2 Replies

Custom .Net Membership And The Login Control?

Mar 16, 2010

I am creating a custom membership provider for a web app that already has it's users stored in an existing database table. I used some code from a tutorial to help jump start my provider but I am a bit lost on how i can interact with the actual log in process.My custom provider has an override method for ValidateUser() and at the moment I am just returning true there. But I want to create a current user object to store in session scope. This object will just store some specifics about the user.

I guess another option would be to use the ASP.Net profile provider but again I am not clear on where to hook into log in process to run some code that would either create this user object or populate the profile information for the current user.

View 2 Replies

C# - Add Reference To Method In Custom Control To A Child Control Created In That Same Custom Control

Feb 3, 2010

I have a custom control that is based off the gridview control located at: here The control is basically a gridview that automatically creates a column of checkboxes that can be used to "check" individual rows in the gridview. During the gridview's "CreateColumns" event, the "checkboxcolumn" is created dynamically. The checkboxcolumn also contains another checkbox in the header that is used to "select/deselect all" checkboxes in the column. Since the gridview does not automatically remember the state of the checkboxes in the checkboxcolumn on postback, I added a method to the control called "SaveCheckBoxState" which stores the indexes of the checked rows in Viewstate, and then I modified the "OnRowDataBound" event to check the Viewstate and reset the checkboxes based on the Viewstate.

I then added a call to "SaveCheckBoxState" in the gridview's OnSorting and OnPageIndexChanging events. This works great so long as I'm sorting or changing pages. However, I need it to update the viewstate everytime someone clicks or unclicks one of the checkboxes. At this time, the checkboxes are rendered with an onclick event that calls some javascript to highlight the row, or in the case of the checkbox in the header, to select/deselect all checkboxes. I need to call the "SaveCheckBoxState" method from the javascript used by the customcontrol, or I need to find a way to modify viewstate from javascript and perform the same action as "SaveCheckBoxState".

I've tried adding the "SaveCheckBoxState" to the onclick event declaration in the checkboxes, but when run, it simply tells me that the method is undefined. It doesn't exist in the parent page, and I don't think I should have to make an event for the parent page to pass the click to. It seems to me this should be all self contained within the custom control. Does anyone know how I can acheive this? Here is the code for the gridview OnPreRender event where the onclick event of the checkbox is set:

protected override void OnPreRender(EventArgs e)
{
// Do as usual
base.OnPreRender(e);
// Adjust each data row
foreach (GridViewRow r in Rows)
{
// Get the appropriate style object for the row
TableItemStyle style = GetRowStyleFromState(r.RowState);
// Retrieve the reference to the checkbox
CheckBox cb = (CheckBox)r.FindControl(InputCheckBoxField.CheckBoxID);
// Build the ID of the checkbox in the header
string headerCheckBoxID = String.Format(CheckBoxColumHeaderID, ClientID);
// Add script code to enable selection
cb.Attributes["onclick"] = String.Format("ApplyStyle(this, '{0}', '{1}', '{2}')",
SelectedRowStyle.CssClass,
style.CssClass,
headerCheckBoxID);
// Update the style of the checkbox if checked
if (cb.Checked)
{
r.BackColor = SelectedRowStyle.BackColor;
r.ForeColor = SelectedRowStyle.ForeColor;
r.Font.Bold = SelectedRowStyle.Font.Bold;
}
else
{
r.BackColor = style.BackColor;
r.ForeColor = style.ForeColor;
r.Font.Bold = style.Font.Bold;
}
}
}

View 1 Replies

Web Forms :: Make A Custom Login Control

Apr 25, 2010

need some guidance on how to make a custom login control where a user needs to input 3 field of input e.g Username, Password and Member ID number in order for them to be able to access a website.

View 3 Replies

C# - Login Control And Custom Membership Provider?

Oct 11, 2010

I am working on implementing a custom membership provider that works against an existing schema in my database and have a few thoughts/questions.The login control will automatically call the ValidateUser method of the membership provider, so no matter how I implement the provider the only thing the login control cares about is the bool value returned by this method. What I am confused about is there could be numerous reasons why a login attempt failed; user is locked out, too many tries in a period of time, etc. There is no way that I see to convey that to the control so it could display the proper message. Other properties of the membership provider such as PasswordStrengthRegularExpression have absolutely no effect on the login control as well (out of the box), I would have hoped that it would automatically somehow translate into regular expression validators, but that doesn't seem to be the case. So it seems that I need to initialize the login control properties with these settings out of the provider configuration if I want them to take on the control itself.

If the only thing that the Login control does out of the box (without manually handling events and doing the initialization as described above) is call the ValidateUser method on the membership provider, I see no way to convey back to the Login control why the validation failed or even doing things like throttling the validation requests based on a certain time window. Ultimately my question is why would I even use the membership provider then in conjunction with the login control? It seems like it was only designed for a Yes/No type response, which is very restrictive. If I want to build in logic with different messages back to the user I need to handle the login control events and call my own authentication classes that will handle all of my business requirements as well as return a custom error message back to the Login control to display to the user so they know why their attempt is invalid.Unless I am wrong in my assumptions, it seems that the interface between the Login control as the membership API is too restrictive to be useful. Perhaps the API works better for other auth controls like ChangePassword better but for the actual Login control I don't see the point.

View 3 Replies

User Controls :: Implement Custom User Login With Roles Without Using Login Control

May 7, 2015

What if, I'm not using the LOGIN CONTROL but rather creating a Custom Control for Login. Is it possible to have user roles and a site map that redirects to its own destination when the user login?

View 1 Replies

C# - How To Change Login Status In LoginView Control

Feb 18, 2011

How to change status from first Template to second template when I'm login into the system?

<asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
<AnonymousTemplate>
[ <a href="~/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome!
[ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="/Logout.aspx"/> ]
</LoggedInTemplate>
</asp:LoginView>

How to detect login status?

View 2 Replies

JQuery :: Show Login Control In Ligh Box Effect So Its Like If I Open On Login Link Login Control Wil Show And Same Time?

Sep 24, 2010

want to use ligh box effect like i have login control and i want to show login control in ligh box effect so its like if i open on login link login control wil show and same time we can control click anywhere in page ??

View 5 Replies

Security :: Add Another Custom Dropdownlist In Login Control To Authenticate The User?

Aug 13, 2010

how can add another dropdown inside the login control and authenticate the user on the basis of user name,password,and location.

is there any other way?

View 5 Replies

Forms Data Controls :: Custom Authentication To SQL DB Using Login Control?

Feb 7, 2011

I have an older custom classic asp app which handles time sheets for my organization. I would like to start migrate this application to asp.net. I am trying to figure out the best approach to implementing user authentication as the classic asp is built from scratch. For the new site, I would like to use the Login control to handle authentication but not sure the best way to wire it up to the existing SQL database with user name, password, and authentication levels. I have found this code snippit from the Microsoft site:

[Code]....

Unfortunately it does not suggest a connection mechanism. What would be the most logical / standardized way of making a connection to the db?

View 1 Replies

C# - No Change For Index Of DropDownList In A Custom Control?

Jun 15, 2010

I have Created A Custom Control which is a DropDownList with specified Items. I designed AutoPostback and SelectedCategoryId as Properties and SelectedIndexChanged as Event for My Custom Control. Here Is My ASCX file Behind Code:

private int _selectedCategoryId;
private bool _autoPostback = false;
public event EventHandler SelectedIndexChanged;
public void BindData()

[Code]....

But Always The Selected Index of CategoryDDL1 is 0(Like default). this means Only Zero Value will pass to the event to update textboxes Data. what is the wrong with my code? why the selected Index not Changing?

View 1 Replies

Web Forms :: Custom Login Control In Masterpage With Coded User Validation?

Jan 17, 2010

I have a little doubt about creating a login control in the master page within a contentplaceholder.

What i want is to create my own login control in the masterpage, using a loginview inside a contentplaceholder. The code is the following:

[Code]....

So far so good, but now i want to create the logic to do the actual login. In a regular aspx page i'll do it in the cmdlogin click event, but as i'm in the masterpage, i'm not sure if i can do that. I actually tried to do it in the code behind of the masterpage, but it didn't work. What can do?? do i ahve to use the asp.net login control?

View 4 Replies

Custom Server Controls :: Custom Control's Constructor / User To Set That variable In The Properties Window After They Drag The Control Onto A Form?

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

Custom Server Controls :: Paging And Sorting Gridview Custom Control Inside Of A Wizard Control?

Dec 24, 2010

here's a situation and I would appreciate your response.

I have programmatically created the Wizard control:

Page_Load(obj s, evargs e)
{
Wizard ClaimDetailWizard = new Wizard();
foreach(int item in selectedItems)
{
//create new step
//added custom control to new step
//add step to wizard
}
//added wizard to a placeholder on a page
}

Based on List I get from Session i added new steps to my wizard To each step I had added a custom control

Each custom control in tern contains another custom Gridview Control in it.

So here's the problem when the page loads for example for two steps. All is good Wizard does what it's supposed to do.

But when I try to use sorting or paging in that custom Gridview. Somehow it displays the gridview I should see in the next step of the wizard.

Also what I'm noticing through debugging. Is that when I press next in the wizard I go back to the original page where I do all of the code specified above, and it recreates the wizzard. But it goes to the next step. Is this the way wizard supposed to work? Just doesn't seem very efficient.

View 1 Replies

Security :: Displaying A Custom Message For Disabled Accounts Upon Sigin - Login Control?

Jan 9, 2011

I am using the SQLMembershipProvider for authenicating users for my web site. I would like to change the default message that is displayed when a user signs in but who's account is disabled. By default, it shows:

Your account has not yet been approved. You cannot login until an administrator has approved your account.

Is there a property for the Login control that allows me to change this message programmatically.

View 2 Replies

Custom Server Controls :: Add This Control To The Page,an Alert To Check The Text Value Of The Custom Control?

Dec 20, 2010

created a Custom Textbox Control that is intended to be a "masked date" textbox, so that I can handle different ways a user might enter in a date and make it work no matter what.I did this by creating a custom control with 3 separate Textboxes one for month,one for day one for year,then do some handling for different things that could be entered and it would all work.

The problem I am having is,when I add this control to the page,if I do an alert to check the Text value of the custom control it just gives me "[ServerControl1]" even if I enter in a date.

I tried doing an AutoPostback after entering so that it would refesh the Viewstate to have the values of the textboxes but the control doesnt seem to actually postback, even though I have it enabled.accessing the Textbox value after someoen
has entered a date?first custom control I have created and have been using google.

My Server Control Code is as follows:

[Code]...

View 1 Replies

Custom Server Controls :: Change Theme To Customized Control?

Jun 15, 2010

I have a customrize control (GridView)

I am trying to add theme for GridView

<asp:GridView ID="GridView1" runat="server" SkinID="GVfour"> // this is work

<JJ:RxGridView ID="JJGV" runat="server" SkinID="GVfour" ... > // this is my custom control , skin wonk work , can't findout the Skin named GVfour

this customrized control was not written by me... I just guess the problem may be the render code..

I found out the customrized control alerady assign Css Style on Gridview when OnPreRender
like this

[Code]....

I also tryied to change skinid on page_preInit

which will return error because , gridview is null..

View 3 Replies

Custom Server Controls :: Unable To Convert User Control To Custom Control

Oct 27, 2010

I have created a user control and am ready to convert it into a custom control. I am trying to follow:

[URL] the steps mentioned in the link.

I am not seeing Build / Publish Web Site option.

I am using VS 2008. I only see Publish User Control but it doesn't give all the settings mentioned below. When I do publish user control, it just copies the ascx file to the desired location. how can I convert the user control to custom control.

View 2 Replies

Accessing Property Value Of A Custom Control By Another Custom Control In Design-time

Oct 18, 2010

I created an Extender which has a custom property that drills down a list XML elements from an xml file, where users can select xml elements during design-time. This works perfectly fine. However, my code only has a hardcoded xml filename (source of the xml elements list) and I need to change this by maxing the xml file user-specified.

What I did is that I created another control (panel) which has a custom property that when clicked (through the ellipsis), it will allow a developer to select the xml file which is supposed to be the source xml file that the Extenders shall use. The filedialog from custom panel's property works perfectly fine.

However, my problem now is that when I drag-drop my Extender, I cannot find a way to get the property value of the custom Panel Control which contains the xml filename. I tried creating a static variable which I thought the custom controls can share but VS2010 is breaking.

View 4 Replies

Web Forms :: Custom Control Can Add Click In The Control Codebehind But Not When Using The Control

Feb 16, 2011

ive created my own custom control, now in the code behind of the custom control file i can add Name.Click += new EventHandler(name); but on the codebehind of the page where ive used the custom control i cannot, is there anyway i can regsiter it as an available attribute to add? my code below and on the image the test codebehind click is not available, how can i get it?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class LargeButton : System.Web.UI.UserControl
{
public string JSFunc { get; set; }
public string SSFunc { get; set; }
public string ImgName { get; set; }
public string LinkText { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
Link.Attributes.Add("onclick", "javascript:"+ JSFunc + ";");
Link.HRef = "javascript:;";
Link.Title = LinkText;
Img.Src = "~/App_Themes/" + Page.Theme + "/Images/Icons32/" + ImgName;
Img.Alt = LinkText;
//Link.ServerClick += new EventHandler(asd);
}
}
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="LargeButton.ascx.cs" Inherits="LargeButton" %>
<a ID="Link" runat="server" class="MenuItemLarge" clientidmode="Static" >
<img ID="Img" align="center" runat="server"/>
<br />
<%= LinkText %>
</a>
<MB:LgButton runat="server" ID="Save"
JSFunc="Save(this)"
ImgName="save_32.png"
LinkText="Save" />

View 4 Replies

How To Consume Razor User Control OR MVC User Control In Layout Page

Mar 5, 2011

It's simple to create both user control from the two world : ASP.NET+Razor or MVC 3.0.But i do not known how to consume the user control FROM the razor"_layout.chtml" page.I want to put such thing within the layout page: <uc:MyTag Prop1="" Prop2="" />So i need to declare this directive at top of the layout file : <%@ Register TagPrefix="uc" TagName="MyTag" Src="Controls/Mytag.ascx" %>

View 1 Replies

Custom Server Controls :: Use Custom Control/user Control?

Oct 12, 2010

I have 3 pages in each page there is a portion of page where it is common in all these three pages.Thought of making the common stuff as a separate control either User control/Custom control.Any suggestions on which one should i use custom/user control

View 2 Replies







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