This statment works but I want to get the value of whatever the user inputted. I do not want a new row in sql, I just want to modifiy companyName. //Create new instance AlternaDB.MarketingDataContext db = new AlternaDB.MarketingDataContext(); //Call the table you want to use AlternaDB.Distributor distributor = db.Distributors.Single(d => d.CompanyName == "Nike"); AlternaDB.Distributor tbl = new AlternaDB.Distributor(); distributor.CompanyName = "krb"; db.SubmitChanges(); ShowDistributors(); CREATE TABLE [dbo].[Distributor]( [DistributorID] [int] IDENTITY(1,1) NOT NULL, [AccountType] [int] NULL, [AccountStatus] [int] NULL, [CompanyName] [varchar](256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, )
User 1414935
Posts
-
linq to sql update -
export to excel from asp.netScrew off no one what's to hear your compliants, get a life.
-
export to excel from asp.netOk, here is what I really what to do. How to I hide the DistributorID when loaded but display it when the excel file is exported. You might be thinking why don't I delete it form the page_load then, well I can't do that cause then my cells will not match up to the database to the LinkButton1_Click event using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class manager_view_distributors : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { AlternaDB.MarketingDataContext db = new AlternaDB.MarketingDataContext(); var products = from p in db.Distributors select new { p.DistributorID, Company_Name = p.CompanyName, Address = p.AddressLine1, p.City, Zip_Code = p.ZipCode, p.State, First_Name = p.Contact1FirstName, Last_Name = p.Contact1LastName, Area_Code = p.Contact1WorkAreaCode, Phone = p.Contact1WorkNumber, Num_Stores = p.NumStores, Num_DSC = p.NumDsc }; GridView1.DataSource = products; GridView1.DataBind(); } protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { GridView1.PageSize = Int32.Parse(DropDownList1.SelectedValue); this.GetData(); } private void GetData() { GridView1.DataBind(); } protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; this.GetData(); } protected void LinkButton1_Click(object sender, EventArgs e) { if (this.rdoBtnListExportOptions.SelectedIndex == 1) { // the user wants all rows exported, turn off paging // and rebing the grid before sending it to the export // utility ExportExcelColumns(); this.GridView1.PageSize = 1000000; GridView1.DataBind(); } else if (this.rdoBtnListExportOptions.SelectedIndex == 2) { // the user wants just the first 100, // adjust the PageSize and rebind ExportExcelColumns(); this.GridView1.PageSize = 100; GridView1.DataBind(); } //Current Page export else if (this.rdoBtnListEx
-
select button in gridview to populate textbox controls in new form (using linq to sql)I need to stick with this format. No binding in the default.aspx source view page. I want to select a row and have that row populate the corresponding textboxes in default2.aspx. In other words if row id 213-46-8915 is selected the last name Green and first name Marjorie will show up in default2.aspx page textboxes. I got those values from the pubs database. Default.aspx CommandName="Select" Text="Select"> code behind: protected void Page_Load(object sender, EventArgs e) { DataClassesDataContext db = new DataClassesDataContext(); var products = from p in db.authors select p; GridView1.DataSource = products; GridView1.DataBind(); } Default2.aspx au_lname
au_fname