TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mich P
NA
6
1k
Gridview webhsop
May 28 2019 6:17 AM
Hi there, I have a GridView and showed them in textboxes. I want to put it into a list and then show it again in a Gridview. How do you do this? It's for a webhsop...
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
public
partial
class
Webshop : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
}
protected
void
GridView1_SelectedIndexChanged(
object
sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow;
txtArtikelnummer.Text = row.Cells[1].Text;
txtArtikelomschrijving.Text = row.Cells[2].Text;
txtPrijs.Text = row.Cells[3].Text;
txtKortingscode.Text = row.Cells[4].Text;
This
is
what I already have
}
protected
void
txtArtikelomschrijving_TextChanged(
object
sender, EventArgs e)
{
}
List<
string
> liArtikelOmschrijving =
new
List<
string
>();
protected
void
Button1_Click(
object
sender, EventArgs e)
{
liArtikelOmschrijving.Add(txtArtikelomschrijving.Text);
// Version 1: create a List of ints and add 4 ints t
}
protected
void
Button3_Click(
object
sender, EventArgs e)
{
GridView2.DataSource = liArtikelOmschrijving;
GridView2.DataBind();
}
}
<
asp:TextBox
ID
=
"txtArtikelnummer"
runat
=
"server"
>
</
asp:TextBox
>
<
asp:TextBox
ID
=
"txtArtikelomschrijving"
runat
=
"server"
>
</
asp:TextBox
>
<
asp:TextBox
ID
=
"txtPrijs"
runat
=
"server"
>
</
asp:TextBox
>
<
asp:TextBox
ID
=
"txtKortingscode"
runat
=
"server"
>
</
asp:TextBox
>
<
asp:GridView
ID
=
"GridView1"
CssClass
=
"GridView"
runat
=
"server"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"Artikelnummer"
DataSourceID
=
"AccessDataSource1"
OnSelectedIndexChanged
=
"GridView1_SelectedIndexChanged"
>
<
Columns
>
<
asp:CommandField
ShowSelectButton
=
"True"
/>
<
asp:BoundField
DataField
=
"Artikelnummer"
HeaderText
=
"Artikelnummer"
InsertVisible
=
"False"
ReadOnly
=
"True"
SortExpression
=
"Artikelnummer"
/>
<
asp:BoundField
DataField
=
"Artikelomschrijving"
HeaderText
=
"Artikelomschrijving"
SortExpression
=
"Artikelomschrijving"
/>
<
asp:BoundField
DataField
=
"Prijs"
HeaderText
=
"Prijs"
SortExpression
=
"Prijs"
/>
<
asp:BoundField
DataField
=
"Kortingscode"
HeaderText
=
"Kortingscode"
SortExpression
=
"Kortingscode"
/>
</
Columns
>
</
asp:GridView
>
<
asp:Button
ID
=
"Button2"
runat
=
"server"
Text
=
"Button"
/>
<
asp:GridView
ID
=
"GridView2"
runat
=
"server"
>
</
asp:GridView
>
<
asp:Button
ID
=
"Button3"
runat
=
"server"
OnClick
=
"Button3_Click"
Text
=
"Button"
/>
<
asp:AccessDataSource
ID
=
"AccessDataSource1"
runat
=
"server"
DataFile
=
"~/GIP3.mdb"
SelectCommand
=
"SELECT * FROM [tblArtikel]"
>
</
asp:AccessDataSource
>
Reply
Answers (
1
)
How to passt Json Object list as a parameter in Web API
Using Angular 7 Lazy Loading with MVC5