.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to fill data from a login to a Formview?

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :ASP.Net
I want to fill a Formview when accessing the webpage where it's on (Page_Load). The data I have when somebody want to go to this page is his logindata.  The only code I see I can use is "User.Identity.Name". But I want his Id, so I can get to fill his UserId. I don't know how to do this. I'm using MySql as a database. My code is (a part of it):I want to fill a Formview when accessing the webpage where it's on (Page_Load).The data I have when somebody want to go to this page is his logindata. The only code I see I can use is "User.Identity.Name".But I want his Id, so I can get to fill his UserId. I don't know how to do this.I'm using MySql as a database.My code is (a part of it):<asp:FormView ID="FormView1" runat="server" DataKeyNames="UserId" DataSourceID="MySQLProfielDataSource"> <ItemTemplate> <asp:Table id="ItemTabel" runat="server"> <asp:TableRow> <asp:TableCell> UserId: </asp:TableCell> <asp:TableCell> <asp:Label ID="UserIdLabel" runat="server" Visible="false" Text='<%# Eval("UserId") %>'

View Complete Post

More Related Resource Links

Library - Fill Columns with data from email

I have an inbound email enabled Library.  The Library has several columns created for it.  I would like to be able to send an email into the Library and have these columns filled from information in the email.  Is this possible using WSS 3.0?  What are the basic steps?  If I understand SharePoint well enough, I'm guessing is that I have to include the columns as Metadata in the body of the email and then assign this Metadata to the appropriate Library columns when new email is uploaded to the Library.

System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


Hi All,

Thank you for advance.

I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

then i restarted the windows service manually and working.

what is the problem in my sql server connection and how to fix that issue?

Login failed for user 'sa'. (.Net SqlClient Data Provider)

Hi,     I am able to login using windows Authentication to my DB server. But when I am trying using Sql server authentication "sa" then following error is coming:   =================================== Cannot connect to .. =================================== Login failed for user 'sa'. (.Net SqlClient Data Provider) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476 ------------------------------ Server Name: . Error Number: 18456 Severity: 14 State: 1 Line Number: 65536 ------------------------------ Program Location:    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)    at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) &

Updating record in sql databse using data from Gridveiw or Formview

Hi Guys, I am making a message module in asp.net with database of sql. i have made a gridview and enabled selecting. and a form view is synchorised with grid view on selecting. i am writing update sql but could not get a way to take data on Gridview or Formview to compare the record in sql database.   this is my page viewImports System.Data Imports System.Data.SqlClient Partial Class homepage Inherits System.Web.UI.Page Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged FormView1.PageIndex = GridView1.SelectedIndex Label1.Text = FormView1.FooterText. End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("login") = False Then Response.Redirect("Login.aspx") End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim db As New SqlConnection db.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Message_Dat.mdf;Integrated Security=True;User Instance=True" db.Open() Dim sql As String = "update into tblMessage (msg_status) values('junk') where msg_Id='" & FormView1.text & &q

FormView Manual Data Updating

I've posted this some place else but have not heard from anyone and hoping I get better luck here.   Note: Sorry about the formating, not sure what happened.I have a FormView that I user for updating a record. There is a link button that when fires should perforom the updating viaBLL and DAL. I am not using built-in ODS and I will not condsider using it. I have all my grids and formviews populated manuualy by calling methods that fetch the data from the database. For instance my details view is populated like this:  protected void DlMembers_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName.ToString() == "Select") { DlMembers.Visible = false; lblError.Text = string.Empty; lblError.Visible = false; fvMemberDetail.Visible = true; fvMemberDetail.ChangeMode(FormViewMode.Edit); MemberBLL getMemberInfo = new MemberBLL(); int Ident = Convert.ToInt32(e.CommandArgument.ToString()); fvMemberDetail.DataSource = getMemberInfo.GetMemberByIdent(Ident); fvMemberDetail.DataBind(); } if (e.CommandName.ToString() == "DeleteSelected") { DlMembers.Visible = true; lblError.Text = string.Empty; lblError.Visible = false; fvMemberDetail.Visible = false; fvMemberDetail.ChangeMode

Accessing master formview data from a nested detail formview?

Hi all, I would like to ask if it is possible to access data on a master FormView from a nested detail FormView. I have a main form (master) with several tabs (detail) and would like to display a label with text from main form that is hidden by the tab at the moment of editting. My asp page looks like this.<asp:FormView ID="fvwCustomer" runat="server" DataSourceID="dsCustomer" DefaultMode="Edit" DataKeyNames="CustomerID"> <EditItemTemplate> <asp:TextBox ID="CompanyTextBox" runat="server" Text='<%# Bind("Company") %>' /> <asp:FormView ID="fvwContactPerson" runat="server" DataSourceID="dsContactPerson" DefaultMode="Edit" DataKeyNames="ContactPersonID"> <EditItemTemplate> <%-- I need to get the value Company from dsCustomer --%> <asp:Label ID="CompanyTextLabel" runat="server" Text='<%# Eval("Company") %>' /> </EditItemTemplate> </asp:FormView> </EditItemTemplate> </asp:FormView>   Is it possible to get the value of the label CompanyTextLabel from CompanyTextBox using just ASP.NET expressions or something similar without writing c# code in

FormView custom data binding problem

Hi there,   I'm using VWD 2010 ASP.NET 4.0 and SQL Server 2008 Also I have login page with the ASP.NET configuration   one of my page has FormView with Update feature   Evryting works fine user login go to my FormView page and update the record.   Now I created a simple function   Protected Function GetUserName() As String        Return User.Identity.Name    End Function   and one of my coloumn call EditedBy   I replaced the Bind("EditedBy") field binding with   Custom binding GetUserName()   When user update it show the current user login name on the screen But it won't show in the table itself (it show null value when i do select statement)   I used to do this with ASP.NET 2.0 with no problem?   How do I fix that?   Thanks, Oded Dror  

User Data from database...can't fill ddl on PageLoad because of DataBound

I have a database where a user inputs data to multiple databound drop down listboxes.  That's saved to my aspnet database.  Then when the page loads again, I want to select the ddls items that the user selected as stored in the database to these databound ddls.  But it doesn't work, because on pageload, they haven't been databound yet.What's the best way to do this?  Do I need to run a SELECT statement for each and every ddl on it's databound event???

How to fill a formview at page_load?

I have a formview and I want to fill it at page_load. The formview must show the data of the person that has logged in.So the question is how can I fill the formview so that is shows the data of the right person (UserId = @Param2) so that the formview is in editmode?This is the code for the Formview:<asp:FormView ID="FormView1" runat="server" DataKeyNames="UserId" DataSourceID="MySQLProfielDataSource"> <ItemTemplate> <asp:Table id="ItemTabel" runat="server"> <asp:TableRow> <asp:TableCell> UserId: </asp:TableCell> <asp:TableCell> <asp:Label ID="UserIdLabel" runat="server" Visible="false" Text='<%# Eval("UserId") %>' /> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell> Geslacht: </asp:TableCell> <asp:TableCell> <asp:Label ID="Gesla

getting more data for a username from the login control

i have went with the standard membership method for validating and logging users into the application.  i have added a column to the adpnet_Users table called customer_number.once the user is logged in, i want to get the customer number for that user.  what is the best / easiest / industry standard method of accomplishing this?

Auto-fill Title and other fields from a data View edit menu

How do I Auto-fill Title and other fields in a list from a data View edit menu. The Title and other current data should transfer from the data view row being edit. Can anyone point me into the right direction how to accomplish this? Thanks. Mike  

About login name data column in DTA trace


Hi Experts,

In our organisation we r running microsoft dynamics nav as client and sql server 2008 std as backend, and at database level there is not a single user with showplan permission so, what i think is to exclude loginname data column from DTA trace. Am i right Sir? (As per my understanding).

Is there any script to view all  permissions for all user?

Does this way DTA would tune my DB as it should be? Or Is there any other fine way?

Thanks in advance

Snehal Trivedi

Does somebody know how to fill a formview?


I have a formview and I want to do a lot with it.

First I want to go from page a to page b where page b is a formview in insert mode.

After the data is in a database a want to go to page b in select mode (readonly). With a button I want to go to update mode, so you can change your profile.

But whatever I do, I stuck with filling up the formview and get the right data.

My program exist off fist make a user with a create user wizard. This works by the way.

Then after this is done I want to go to a profile page and there you have to fill in your address etc... This also works.

But what doesn't work is that when somebody has filled in his profil and useraccount is to go back to his profile data.

I have use the following code:

            FormView1.DefaultMode = FormViewMode.ReadOnly;


FormView1.DefaultMode = FormViewMode.ReadOnly;

What are the options to change mode and what do I have to

Using asp.net login control USERID to retrieve data from table using a where clause.


Protected Sub SqlDataSource1_inserting(ByVal sender As Object, ByVal e As SqlDataSourceCommandEventArgs) Handles SqlDataSource1.Inserting
        Dim MemUser As MembershipUser
        MemUser = Membership.GetUser()
        UserID.Text = MemUser.ProviderUserKey.ToString()
        e.Command.Parameters("@UserId").Value = MemUser.ProviderUserKey.ToString()

Create Excel file dynamically in SSIS package and fill it by resultset data returned by Stored proce


Hello Every One,

I have a scenario in which i am executing a Stored Procedure which returned a result set.

I want to create a Excel file [name_date_time] dynamically, and fill result set data into Excel file. And then finally sent Excel file to Specific user[Email ID].

Point is that the excel file should have unique name so i want to give name as name_date_time.

So every time when package run new file is created with unique name.


Can any one suggest me who to create Excel file and fill result set data into Excel file.

And then finally send that Excel file ?







How to Insert Data Using EntityDataSource in FormView - C#


I am new to formview .My formview works fine, when I insert data into the database directly and then do an update on it. It throws an error when I try to insert a new record.  The error just says

"An error occurred while updating the entries. See the inner exception for details."


How to insert data into the table using an entity dastasource? Please help!!



Would like to hide Formview's "Update/Cancel" and make data changes when new page is selected


I have a Formview that is only showing a question, and two checkboxes (True / False).  It's cumbersome for the client to have to click "Update" every time they click a checkbox.

Is there a way to have Formview update the data when the page is changed, or form is closed?  (I see those events, but know how to force data to update from in them).

The application is testing individuals, so 95% of the time the person navigating through the forms will be updating data.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend