I have a dialog where I will register one (or multiple) contacts.
The contact goes to the gridview, where they can be edited or deleted.
The data in the gridview can only be saved in the database at the end of the process.
How can I get it?
Model Code OBS: I do not have a good sample of CSharp or HTML code 'Cuz I do not know how to achieve this. All my codes are looking at the dirty atom (already trying many things) My grid U is an eskx, and the modal is in the same ASCX. I accept some temporary table, or something like that will help, but I have never done anything like this (a shop Cart software looks like), and I do not even know how it looks for. Thanks if you can sample some code, this is very much It would be good. Edit: I have given this code: CSHP code: I am creating a temporary gridview, but the data is empty, I tried to measure it with my text, but I was not able, I familiar How do I get data from Gridview to my database (I believe this is a simple part, then I do not pay attention to it at that time) Edit: With my solution North makes me. Now I get value from my model! Just need some things now (I belive). 1- Get data in your database to load GridView for the first time (if it is a version), and load it with new temporary data 2- New temporary save data. Done: 1- I load into my view and use it to load the grid. 2- Also using your approach to saving your data in the database.
$ (function () {$ (". ModalBox"). Dialog ({autoOpen (false, height: 400) , Resizable: false, drag-able: false, width: 602, model: true, open: function (type, data) {$ (this) .Parent (). AppendTo ($ ("form: first")); }}}}};
[serialable] Public class TabelaTempContato {Received {Public Entity ID Client; Set; } Public String Nome {Received; Set; } Public String Email {get; Set; } Public string telegraph {get; Set; } Public string CPF {receipt; Set; } Public string RG {get; Set; } Receive public string departments { Set; } Public string cargo {received; Set; }} Get Safe List Listatelamp {(if (this.ViewState [ "TabelaTemp"] null ==) {this.ViewState [ "TabelaTemp"] = new List ();} return (list) this.ViewState [ "TabelaTemp" ];}} protected void AddItem () {this.ListaTabelaTemp.Add (new TabelaTempContato ()); This.gvContato.DataSource = this.ListaTabelaTemp; this.gvContato.DataBind ();} protected void btnTest_Click (object sender, EventArgs e } {This.AddItem ();}
[Siriylizhebl] public structure TempContato {public Int ID client receives {; Set;} public string name {set; set; } Public String Email {get; Set; } Public string telegraph {get; Set; } Public string CPF {receipt; Set; } Public string RG {get; Set; } Receive public string departments { Set; } Public string cargo {received; Set; }} Protected list ListaTabelaTemp {get (if (this.ViewState [ "ListaTempContato"] == null) it. ViewState [ "ListaTempContato"] = new List (); return (list) it. ViewState [ "ListaTempContato"];} } protected void AddItem () {TempContato tempContato = new TempContato (); //tempContato.IDCliente = convert. ToInt32 (this.txtEmailContato.Text); TempContato.Nome = this.txtNomeContato.Text; TempContato.Email = this.txtEmailContato. Text; TempContato.Telefone = this.txtTelefoneContato.Text; TempContato.Cpf = this.txtCpfContato.Text; TempContato.Rg = this.txtRgContato.Text; TempContato.Departamento = this.ddlDepartamentoContato.SelectedValue; TempContato.Cargo = this.ddlCargoContato SelectedValue; this.ListaTabelaTemp.Add (tempContato);} protected void AtualizarGrid () {this.gvContato.DataSource = this.ListaTabelaTemp; this.gvContato.DataBind ();} security Nil btnTest_Click (Object Sender, EventArgs e) {this.AddItem (); this.AtualizarGrid ();}
Comments
Post a Comment