Tech
Forums
Jobs
Books
Events
Live
Interviews Prep
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Asp.net/C# Get repeater row data through checkbox
Fares Ayyad
Nov 10 2016 7:58 AM
399
Reply
Hello i have a repeater that will present data as a table with checkbox for each row, so i want to show the checked rows data when a button is clicked.
.aspx code:
"rptItems"
runat=
"server"
>
class
=
"table table-bordered table-hover table-responsive table-striped table-condensed"
>
Goods Desc
Balance Units
Exit Units
"cbItem"
runat=
"server"
/>
<%#Eval(
"ItemDesc"
) %>
<%#Eval(
"InvoicBalanceUnits"
) %>
"txtExitUnits"
runat=
"server"
>
"revUnits"
runat=
"server"
Display=
"Dynamic"
ControlToValidate=
"txtExitUnits"
ValidationExpression=
"^\d+$"
ErrorMessage=
"Please, insert a number."
CssClass=
"text-danger"
>
"rfvUnits"
runat=
"server"
Display=
"Dynamic"
ControlToValidate=
"txtExitUnits"
ErrorMessage=
"Insert number of units."
CssClass=
"text-danger"
>
the code behind:
protected
void
btnExit_Click(
object
sender, EventArgs e)
{
List
selectedItems = rptItems.Items.Cast
().Where(x => ((CheckBox)x.FindControl(
"cbItem"
)).Checked).ToList();
epeater1.DataSource = selectedItems;
Repeater1.DataBind();
Repeater1 will contain the data selected through :
selectedItems
this is the repeater1
"Repeater1"
runat=
"server"
>
class
=
"table table-bordered table-hover table-responsive table-striped table-condensed"
>
Goods Desc
Balance Units
<%#Eval(
"ItemDesc"
) %>
<%#Eval(
"InvoicBalanceUnits"
) %>
when i run the code it gives me an error that "ItemDesc" isn't exist in repeater1, whats wrong ?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Windows authentication user log?
next and previous link in hard coding in asp.net core mvc