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

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

Formview Update - Email

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :ASP.Net
Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: 

View Complete Post

More Related Resource Links

Help ~~ How to Update Binary Image on Formview

Hi All ~~ I'm confused, Can i have some help please... Thanks
Database: Books
uid dataType uniqueidentifier
Cover dataType image 
aspx :
 <asp:FormView ID="FormView1" runat="server" BackColor="LightGoldenrodYellow"   BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataKeyNames="uid"     DataSourceID="SqlDataSource1" ForeColor="Black" Width="525px">
         <table class="table_width">
                 <td class="imageWidth">
                     <asp:Image ID="Image1" runat="server" Height="245px" 
                                       ImageUrl='<%# IIF(Eval("Cover") Is DbNull.Value, "~/Styles/Global/CFZ-No-Images.png", Eval("uid", "~/ImageServices.ashx?BooksID={0}")) %>' Width="180px" />

Possible to insert & update in formview?

I have a formview where DefaultMode="Insert". Underneath, I have a gridview that displays the information from the inserts. Is there a way to update the information as well as insert? Maybe there is a better way to do what I'm trying to do. Any help is appreciated. Thanks!

Possible to update and insert from formview?

I have a formview where DefaultMode="Insert". Underneath, I have a gridview that displays the information from the inserts. Is there a way to update the information as well as insert? Maybe there is a better way to do what I'm trying to do. Any help is appreciated. Thanks!

SqlDataSource, FormView, and Update with stored procedure in code behind

Hello, Using a FormView with a SqlDataSource, I'm attempting to Update data by calling a stored proc in code behind. I was having trouble getting parameters using Update Parameters in the SqlDataSource, but found a working solution by coding the parameters. The problem now is I'm getting an "Updating is not supported by data source 'XYZ' unless UpdateCommand is specified'. I saw some previous posts on the forums, but didn't find them very enlightening. 

Update in formview doesn't work, but I don't get an error message?

I have a datasource:<asp:SqlDataSource ID="MySQLProfielDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:WAPMySQLConnStr %>" InsertCommand="INSERT INTO usergegevens(UserId, Geslacht, Voornaam, Tussenvoegsel, Achternaam, Adres, Huisnummer_toev, Postcode, Woonplaats, TelnrV, TelnrM, Geboortedatum) VALUES (@Param1, @Param2, @Param3, @Param4, @Param5, @Param6, @Param7, @Param8, @Param9, @Param10, @Param11, @Param12)" ProviderName="<%$ ConnectionStrings:WAPMySQLConnStr.ProviderName %>" SelectCommand="SELECT UserId, Geslacht, Voornaam, Tussenvoegsel, Achternaam, Adres, Huisnummer_toev, Postcode, Woonplaats, TelnrV, TelnrM, Geboortedatum FROM usergegevens WHERE (UserId = @Param1)" UpdateCommand="UPDATE usergegevens SET Geslacht = @Param1, Voornaam = @Param2, Tussenvoegsel = @Param3, Achternaam = @Param4, Adres = @Param5, Huisnummer_toev = @Param6, Postcode = @Param7, Woonplaats = @Param8, TelnrV = @Param9, TelnrM = @Param10, Geboortedatum = @Param11 WHERE (UserId = @Param12)" onselecting="MySQLProfielDataSource_Selecting" onupdating="MySQLProfielDataSource_Updating" onselected="MySQLProfielDataSource

Edit, Update and Cancel Buttons in FormView

Hi,    I have created a Formview1 which have 3 columns Name, Status and Description. I just wanted to update display the Status and Description but not the Name. Can anyone give me any guidelines how I can do this.  I have use the following code on my asp.net page<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlApplication" DataKeyNames="applicationID"> <ItemTemplate> <asp:Label ID="lblAppsID" runat="server" Visible="false" Text='<%# Bind("applicationID") %>' /> </ItemTemplate> <ItemTemplate> <asp:Label ID="lblAppsName" runat="server" Font-Size="X-Large" Font-Bold="True"><%# Eval("applicationName") %></asp:Label> <br /> <br /> <ItemTemplate> Status: <asp:TextBox ID="txtSatusdesc" runat="server" Text='<%# Eval("Status") %>' ></asp:TextBox> </ItemTemplate><!--- ******** Need to create button Edit, update, Cancel button here to update status ************---> <EditItemTemplate> <asp:TextBox ID="txtSatusdescUpd" runat="server" Text='<%# Bind("Status") %>' ></asp:TextBox> </EditItemTemplate> <br /> <br />

Update email?

I have this code and I'm logged in to the site. Now I want to update my email, but that will not work. Alla other properties are updateed, but not my email. Any ideas why?
private string firstName, lastName, address, zipCode, city, phone, cellPhone, eMail;
public string Email
        get { return eMail; }
        set { eMail = value; }

public ProfileWrapper()
        ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
        firstName = profile.FirstName;
        lastName = profile.LastName;
        address = profile.Address;
        zipCode = profile.ZipCode;
        city = profile.City;
        phone = profile.Phone;
        cellPhone = profile.CellPhone;
        newsLetter = profile.NewsLetter;
        wantSms = profile.WantSms;
        eMail = Membership.GetUser(profile.UserName).Email;

    public void UpdateProfile()
        ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon;
        profile.FirstName = firstName;
        profile.LastName = lastName;
        profile.Address = address;
        profile.ZipCode = zipCode;
        profile.City = city;
        profile.Phone = phone;
        profile.CellPhone = cellPhone;
        profile.NewsLetter = newsLetter;

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.



Can't update the Membership email address


In my update Membership account routine, I have the sub:

    Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick
        'Update this account in the database
        Membership.GetUser.Email = TextBoxEmail.Text

        Membership.GetUser.ChangePasswordQuestionAndAnswer(HiddenFieldConfirmPassword.Value, TextBoxQuestion.Text, TextBoxAnswer.Text)

        Dim dcMembership As New MembershipDataContext()
        Dim vUserId As Guid = Membership.GetUser.ProviderUserKey
        Dim vMembershipRecord = dcMembership.wmsUsersPlus.SingleOrDefault(Function(x) x.UserID = vUserId)
        If vMembershipRecord IsNot Nothing Then
            vMembershipRecord.FirstName = TextBoxFirstName.Text
            vMembershipRecord.LastName = TextBoxLastName.Text
        End If
    End Sub

This sub runs successfully and everything is updated, including the membership question and answer, except the membership.getuser.email address which is not updated.

In de-bug mode, TextBoxEmail.text contains the updated email address but the membership record is not updated.

Conversely, I can get the current email address successfully earlier in the code with:

TextBoxEmail.text = Member

ASP.Net Gridview Edit Update Cancel Commands

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Update Vs SystemUpdate

Many of you might noticed that share point ListItem has Update() method as well as SystemUpdate().

What is the difference between these two methods and why MOSS has two different APIs for updating an ListItem

SqlCommand.ExecuteNonQuery() returns -1 when doing Insert / Update / Delete

Sometimes you end up with a return value of -1 when using the SqlClient.SqlCommand.ExecuteNonQuery method.

Why is that?

Well, the ExecuteNonQuery method is there for statements for changing data, ie. DELETE / UPDATE /INSERT, and the returned value are the number of rows affected by that statement.

When checking the documentation we can see that there are some conditions that return -1.

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command.

When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of

rows affected by the trigger or triggers. For all other types of statements, the return value is -1. If a rollback occurs, the return value is also -1.

PrintPocketCE Print Pocket Excel, Pocket Word and email files

Version 3.560 (May 15, 2009):

Important bug fix: a slight difference in how some devices create fonts was causing a few devices to have significantly longer print times for large print jobs.

Adjusted PocketJet printer paper feed commands

Other minor fixes and enhancements.

Version 3.559 (Mar 5, 2009):

Added support for Martel MCP78xx printers

Version 3.558 (Aug 20, 2008):

Added support for Martel MCP78xx printers

Version 3.557 (June 27, 2008):

Fixed error in Canon printer support

Fixed COM0 port selection

Version 3.556 (June 15, 2008):

Added support for Brother MW-260

Added support for Sato MB400

Version 3.555 (Aug 8, 2007):

Added support for Pentax RuggedJet 3 and RuggedJet 4 printers

Changed Epson TM-P60 support to maximum page width of 1200 dots

Version 3.551 (Aug 1, 2006):

Added Peripheral Nomad printer support

Version 3.550 (Mar 23, 2006):

Added Panasonic JT-H200PR printer support

Added Pocket Spectrum printer support

Fixed problem with WM5.0 "inverted image" problem

Send Email from SQL Server Express Using a CLR Stored Procedure

One of the nice things about SQL Server is the ability to send email using T-SQL. The downside is that this functionality does not exist in SQL Server Express. In this tip I will show you how to build a basic CLR stored procedure to send email messages from SQL Server Express, although this same technique could be used for any version of SQL Server.

If you have not yet built a CLR stored procedure, please refer to this tip for what needs to be done for the initial setup.

>>>How to update multiple rows of gidview by one click



I want to add multiple rows of a gridview if the data for multiple fields are same.

Idea for this is that a user may search a record with some parameter e.g. Sector, plot.

For example 15 records being displayed in gridview.

There should be checkbox before every row and if user wants to update Plot and Flat No that is same for 10 rows out of 15 so he will check the rows and update.

For this a dialog box should appear asking for the parameter i.e. Plot and Flat or something else next time may be it will be City or country. Moreover, there is already an Edit button to update records, when user click it another page open for the record to be updated and whatever he wants to update, it updates.

Hope everone understand the scenario.

I don't want to disturb the already provided Edit functionality and want to provide same record to be updated.

Any idea in this regard would be appreciated.

Formview LinqData source not allowing updates


OK, I'm confused.  I've set up a formview with a Linqdata source to allow users to edit records.  When I run it, edit data and submit, it blows up and tells me "Linq datasource6  does not support the Select property when the Delete, Insert or Update operations are enabled."  I googled that warning and saw a couple of posts on this forum saying the problem is the slect statement has to be removed from the Linq data source for it to allow updates. 

But if I remove the select statement then how do I show the user specific info on pageload?   plus I thought the two way databind was an advantge of the datasource control.




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