Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Cómo almacenar información en la lista de vista en la base de datos

¿Cómo puedo guardar filas creadas en la vista de lista en mi base de datos? ¿Cómo puedo acceder a los valores en la (vista de lista)? ¿Cómo guardar los valores creados en la lista de vistas en la base de datos?

 <asp:ListView ID="ListView1" runat="server"> <ItemTemplate runat="server"> <tr class="text-center"> <td class="product-remove"></td> <td class="image-prod"> <div class=""> <asp:Image ID="Image1" CssClass=" img" ImageUrl='<%# "../img/" + Eval("picture" )%>' runat="server" /> </div> </td> <td class="product-name"><%# Eval("namebook") %> </td> <td id="t_Plural" runat="server" class="price "><%# Eval("Price") %> </td> <td class="quantity"><%# Eval("titel") %></td> <td class="col-2"> <asp:Button ID="delete" CssClass="btn btn-outline-danger" CommandArgument='<%# Eval("id")%>' OnClick="delete_Click" runat="server" Text="حذف کالا" /> </td> <td> <%-- <input id="quantity2" runat="server" type="number" AutoPostBack="true" oninput="lod_gheymat" onserverclick="lod_gheymat" value="" min="1" max="20" />--%> <asp:TextBox ID="quantity2" runat="server" CssClass="input-wrap" AutoPostBack="true" OnTextChanged="lod_gheymat" Text="1" min="1" max="20"></asp:TextBox> </td> <td > <div class="row"> <asp:Label ID="lbl_Plural" runat="server" Text="0"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp; <span class="row"> تومان</span> </div> </td> </tr> </ItemTemplate> </asp:ListView>

ingrese la descripción de la imagen aquí

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

protected void savetodatabase_Click(object sender, EventArgs e) { System.Web.UI.HtmlControls.HtmlGenericControl Labelid; TextBox quantity2; foreach (ListViewItem rRow in ListView1.Items) { itemlist iteml = new itemlist(); quantity2 = (TextBox)rRow.FindControl("quantity2"); Labelid = (System.Web.UI.HtmlControls.HtmlGenericControl)rRow.FindControl("Labelid"); iteml.quantity = quantity2.Text; iteml.bookid = Convert.ToInt32(Labelid.InnerText) ; iteml.Date = DateTime.Now; iteml.userid = Convert.ToInt32(Session["userid"].ToString()) ; DatabaseContext context = new DatabaseContext(); context.itemlists.Add(iteml); context.SaveChanges(); } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!