.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

FormView Manual Data Updating

Posted By:      Posted Date: September 09, 2010    Points: 0   Category :ASP.Net
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

View Complete Post

More Related Resource Links

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

Data Points: Updating Data in Linked Servers, Information Schema Views, and More


Every day a developer somewhere needs to write code to iterate through SQL ServerT system objects, query and update tables in linked servers, handle optimistic concurrency, and retrieve column and stored procedure metadata.

John Papa

MSDN Magazine November 2004

How to fill data from a login to a Formview?

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") %>'

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  

Updating an item in one list based on data from another

I thought I understood this fairly well, but it seems that I am missing something.  I have created a change management site that uses a calendar list to mark upcoming changes to our IT systems.  I have also created a second list to track some information about the change items that I don't want to show up on the calendar, such as what the outcome of the change was or if the change process was properly followed.  So I have the calendar list and another list called results.  I know that there needs to be a unique identifier that each list item will have in common, so in the results list I created a column called Change Number.  When a new change item is created in the Change Management calendar a workflow runs that notifies some people that a new change has been submitted, and the last step in that workflow creates a new list item in the results list and sets the Change Number field to be equal to the current item ID field.  That part is working right now.  When I create a new change item I can open the results list and see that there is a new item and it has the proper number in the Change Number field. What isn't working is when I try to take actions in other workflows that use data from both lists.  An example is notifying the creator of the change that it has been approved.  When the list item is changed a workflow starts that

Best way to handle constantly updating data.


I'm building a browers-based game that will need to constantly be updating EVERYONE'S accounts regularly; what is the best way to go about doing this?  Creating a process that runs every time someone goes to a page on my site slows down the load time immensely.   Do I need to create a windows scheduled task that calls this/these process(es)?  It will need to constantly run.

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!!



Inserting/updating DB looping Excel data of huge number of records




    I have requirement to read the excel data and based on some conditions ih ave either insert/ update the data in to Oracle tables. to check the condition I have to loop through the 4 columns for 4 conditions which may consist of huge number of records, where performance issue arise here. please put me in the right way or suggest me a best approach to break through the performance issue as well.

ofcourse i am writing in a service.

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.



Infopath form updating from secondary data connection initally, then not!


Let me set up what I am doing...

I have a table with multiple text boxes. Each of these text boxes pulls a total for it's corresponding item from a SharePoint List. Each item has 3 boxes that return three different totals.(Filters correctly into This week, This month, and Year to date).

When I open the InfoPath form initially all the columns return the correct totals. Now If I edit the date created on an item; so that it was created last month. Nothing changes on my infopath form. The created this month total remains the same.

I have my data connection set to update everytime a form is opened.

What am i missing?


Help with checkboxlist in formview edittemplate data display



I can insert a checkboxlist selected value as comma delimited string into the database. But I have hard time to reload it in formview edit mode.  I added a hidden label to retrieve the comma delimited string and try to use checkboxlist databound event, but it doesn't work. I don't know what problem is in my code. Please help me:

protected string sessiontypestr = string.Empty;

protected void chkType_DataBound(object sender, EventArgs e)
            CheckBoxList c = (CheckBoxList)FormView1.FindControl("chkType");
            if (c != null)

                Label test = (Label)(FormView1.FindControl("lblhiddensessiontype"));
                sessiontypestr = test.Text;

                string[] items = sessiontypestr.Split(',');

                for (int i = 0; i < c.Items.Count; i++)
                    if (items.Contains(c.Items[i].Value))
                        c.Items[i].Selected = true;


<asp:CheckBoxList ID="chkType" runat="server" Font-Size="Smaller" 
                SelectedValue='<%# Bind("session_type") %>' 

Compute Values in FormView From Row Data


Here's what I am trying to do:

Inside Form View Want to display the average of a field based from field1/field2


Field 1 = 10

Field 2 = 5

Field 3 would equal 2 (Field 1 / Field 2)

How would I go abaout doing this.  Code currently looks like:

<asp:Label ID="sales_per_qtr" runat="server" Text='<%# Bind("total_sales/total_qtrs") %>' />

Using custom bind expression in the formview but it won't let me do this...

All input appreciated.


Problem with gridview manual updating


 I have a gridview that is connected to a SQL db. I am handling the update manually in the GridView1_RowUpdating event where I pull data out of the edited row the make calls to classes that update the DB. I am not using the built in updatecommand of the grdiview because I am doing some complex and multiple table updates.

The issue is that after I run all the code the gridview never comes out of edit mode so my page just hangs.

Any help would be appreciated.


Insert Parent and Child row in ONE Formview Dynamic Data


Hi All,

I am at my wits end and need some help, I have a dynamic data site, and have built a formview for my parent table, Claims (parent), Claims has a child table called DamagedVehicles, I want all the fields on the Cliams table and the fields on the DamagedVehicle to be displayed for insert on the same formsview, when the user fills in all data it should insert the claim and the damagedvehicle at the same time and set the foriegn key on the Damagedvehciles row to the Primary key of the claim, I dont know were to start any examples in VB.net or C# will be greatly appricated. i have been search for 3 days now trying to come to a solution and nothing has worked.

thanks in advance.

Accessing Oracle Table data and updating using SharePoint 2010 List



We are trying to access Oracle database table through SharePoint 2010 List. The functionality required is, the user should be able to read the data from the Oracle table in to the SharePoint 2010 List and should also be allowed to update the list and in turn the data should be updated back in to the oracle table.

Over and above any changes made to the oracle table by users, should be updated in the sharepoint 2010 list. Which means the users require a two synchronisation from SharePoint 2010 List to Oracle table and vice versa.

let us know if anyone has worked on this before.

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