473,465 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ASP.netData Binding Question!

Hello !
This code is working greate up to the point to add a new Row, I try all and still don't work.

All I need to to is Add a New Row so the textbox get's clean and the user can enter the new record information.

using System;

using System.Collections;

using System.ComponentModel;

using System.Net;

using System.Text;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

using MagnumCMS.DataAccess;

namespace MagnumCMS

{

/// <summary>

/// Summary description for Usersmnt.

/// </summary>

public class Usersmnt : System.Web.UI.Page

{

protected System.Web.UI.WebControls.DataGrid DataGrid1;

protected MagnumCMS.DataAccess.MagnumCMSDataSetImage magnumCMSDataSetImage1;

protected System.Web.UI.WebControls.Label Label1;

protected System.Web.UI.WebControls.TextBox tbFullName;

protected System.Data.DataView parentRows;

protected System.Data.DataRowView currentParentRow;

protected System.Web.UI.WebControls.Button bttDel;

protected System.Web.UI.WebControls.Button bttSave;

protected System.Web.UI.WebControls.Button bttAddNew;

protected UsersData UsersDataObj = new UsersData();

protected System.Web.UI.WebControls.TextBox TextBox1;

protected System.Web.UI.WebControls.TextBox TextBox2;

protected MagnumCMS.DataAccess.MagnumCMSDataSet.UsersRow UsersRowObj;
private void Page_Load(object sender, System.EventArgs e)

{

if ( !IsPostBack)

{

UsersDataObj.LoadAll(magnumCMSDataSetImage1);

this.DataBind();

}

}
#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}
/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.magnumCMSDataSetImage1 = new MagnumCMS.DataAccess.MagnumCMSDataSetImage();

((System.ComponentModel.ISupportInitialize)(this.m agnumCMSDataSetImage1))..BeginInit();

this.DataGrid1.SelectedIndexChanged += new System.EventHandler(this.DataGrid1_SelectedIndexCh anged);

this.bttSave.Click += new System.EventHandler(this.bttSave_Click);

this.bttAddNew.Click += new System.EventHandler(this.bttAddNew_Click);

//

// magnumCMSDataSetImage1

//

this.magnumCMSDataSetImage1.DataSetName = "MagnumCMSDataSet";

this.magnumCMSDataSetImage1.Locale = new System.Globalization.CultureInfo("en-US");

this.Load += new System.EventHandler(this.Page_Load);

((System.ComponentModel.ISupportInitialize)(this.m agnumCMSDataSetImage1))..EndInit();

}

#endregion

private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)

{

UsersDataObj.LoadAll(magnumCMSDataSetImage1);

if (magnumCMSDataSetImage1.Users.Rows.Count > 0)

{

UsersRowObj = (MagnumCMS.DataAccess.MagnumCMSDataSet.UsersRow) magnumCMSDataSetImage1.Users.Rows[this.DataGrid1.SelectedIndex];

magnumCMSDataSetImage1.Users.DefaultView.RowFilter = " PKID_Users = " + UsersRowObj.PKID_Users.ToString();

}

this.DataBind();

}

private void bttAddNew_Click(object sender, System.EventArgs e)

{

UsersDataObj.LoadAll(magnumCMSDataSetImage1);

//magnumCMSDataSetImage1.Users.NewRow();

DataRowView aa = magnumCMSDataSetImage1.Users.DefaultView.AddNew();

aa.BeginEdit();

//magnumCMSDataSetImage1.Tables["Users"].DefaultView.AddNew();

magnumCMSDataSetImage1.Users.Rows.Add(aa.Row);

//this.tbFullName.Text = (string) DataBinder.Eval(magnumCMSDataSetImage1, "Tables[Users].DefaultView.[0].FullName");

Hire, it allways show on the screen the first record!

bool aaaaa= aa.IsNew;

//this.DataBind();

}

private void bttSave_Click(object sender, System.EventArgs e)

{

UsersDataObj.Update(magnumCMSDataSetImage1);

}

}

}

Nov 15 '05 #1
0 1236

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Vinay | last post by:
Hello My question is regarding "weak external symbols". Consider the following eg. class test { public : int func1(void); {cout <<"func1";} int func2(void);
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
1
by: Bruce | last post by:
Hi, there, I meet a problem about comboBox binding. -------------------- Database: Northwind Tables: 1) Products 2) Categories I create a form (named "form1") to edit the record from...
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
14
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.