What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 222 |  Welcome, Guest!   Register  Login
 Home > Forums > ASP.NET > asp.net doubt.........! ...
Shinna123

asp.net doubt.........!

Replies: 2 | Posted by: Shinna123 on 6/24/2012 | Category: ASP.NET Forums | Views: 331 | Status: [Member] | Points: 10  


i ve created a website in which there several role like sales,admin...

my task is that i want to allow nly sales person to add a new a/c

so for that i m logging in as sales n then sign up page opens which contains a create user wizard which has been customized to add an intermediate step but the problem here is this that this create user wizard never reaches the complete step.................i cant understnd wat is the problem....

plz help

thnx in advance


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Johnbhatt
Johnbhatt  
Posted on: 6/24/2012 11:09:10 AM
Level: Starter | Status: [Member] | Points: 25

What is problem in Create User Page, please illustrate with Code.

John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Shinna123, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Shinna123
Shinna123  
Posted on: 6/25/2012 12:37:31 AM
Level: Starter | Status: [Member] | Points: 25

code behind :

Imports System.Data.SqlClient

Partial Class sales_AddNewCustomer
Inherits System.Web.UI.Page



Protected Sub CreateUserWizard1_ActiveStepChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.ActiveStepChanged


'Have we jst reached the complete Step?
If CreateUserWizard1.ActiveStep.Title = "Complete" Then

Dim UserSettings As WizardStep = CType(CreateUserWizard1.FindControl("UserProfileSettings"), WizardStep)
Dim FirstName As TextBox = CType(CreateUserWizard1.FindControl("tb_FirstName"), TextBox)
Dim LastName As TextBox = CType(CreateUserWizard1.FindControl("tb_LastName"), TextBox)
Dim City As TextBox = CType(CreateUserWizard1.FindControl("tb_City"), TextBox)
Dim strPostalCode As String = ddl_Zip.SelectedItem.Text

'Update the userprofile record for this user
'get the userid for the just added user
Dim newUser As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName)
Dim newUserID As Guid = CType(newUser.ProviderUserKey, Guid)

'add the newly created user to the customer role
Dim uName As String = CreateUserWizard1.UserName.ToString
Roles.AddUserToRole(uName, "customer")



'Insert a new record into UserProfile
Dim connectionstring As String = ConfigurationManager.ConnectionStrings("cs-ToolRental").ConnectionString
Dim updatesql As String = "insert into [TR_UserProfile] ([UserID],[FirstName],[LastName],[City],[PostalCode]) values(@UserId,@FirstName,@LastName,@City,@PostalCode)"


Using myconnection As New SqlConnection(connectionstring)
myconnection.Open()
Dim mycommand As New SqlCommand(updatesql, myconnection)
mycommand.Parameters.Add(New SqlParameter("@PostalCode", strPostalCode))
mycommand.Parameters.AddWithValue("@FirstName", FirstName.Text.Trim())
mycommand.Parameters.AddWithValue("@LastName", LastName.Text.Trim())
mycommand.Parameters.AddWithValue("@City", City.Text.Trim())
mycommand.Parameters.AddWithValue("@UserId", newUserID)
mycommand.ExecuteNonQuery()
myconnection.Close()
End Using

End If


End Sub




End Class




inline code:

<%@ Page Language="VB" MasterPageFile="~/Master/tool.master" AutoEventWireup="false" CodeFile="AddNewCustomer.aspx.vb" Inherits="sales_AddNewCustomer" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<div>
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
</asp:CreateUserWizardStep>
<asp:WizardStep ID="WizardStep1" runat="server" Title="User Profile">
<table style="width: 292px; height: 74px">
<tr>
<td style="width: 84px; text-align: right; height: 26px;">
<asp:Label ID="Label1" runat="server" Text="First Name:" Width="84px"></asp:Label>
</td>
<td style="width: 79px; height: 26px;">
<asp:TextBox ID="tb_FirstName" runat="server" Width="173px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 84px; text-align: right">
<asp:Label ID="Label2" runat="server" Text="Last Name:" Width="86px"></asp:Label>
</td>
<td style="width: 79px">
<asp:TextBox ID="tb_LastName" runat="server" Width="173px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 84px; height: 21px; text-align: right">
<asp:Label ID="Label3" runat="server" Text="City:"></asp:Label>
</td>
<td style="width: 79px; height: 21px">
<asp:TextBox ID="tb_City" runat="server" Width="173px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="width: 84px; text-align: right">
&nbsp;<asp:Label ID="Label4" runat="server" Text="State:"></asp:Label>
</td>
<td style="width: 79px">
<asp:DropDownList ID="ddl_Zip" runat="server" DataSourceID="SqlDataSource1" DataTextField="PostalCode"
DataValueField="PostalCode" Width="115px">
</asp:DropDownList>
&nbsp;
</td>
</tr>
</table>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:cs-ToolRental %>"
SelectCommand="SELECT [PostalCode] FROM [TR_PostalCode]"></asp:SqlDataSource>
</asp:WizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>

</div>



</asp:Content>

Shinna123, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/23/2013 3:25:56 PM