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
Narasiman nar
NA
64
22.1k
How to update selected checkbox row to database from gridvie
Jun 14 2018 12:23 AM
My code as follows
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
BindData();
}
}
protected
void
BindData()
{
String strConnString = ConfigurationManager.ConnectionStrings[
"ConnectionStrings"
].ConnectionString;
SqlConnection con =
new
SqlConnection(strConnString);
SqlCommand cmd =
new
SqlCommand(
"select * from [transact].[transaction_item] where status = 'new'"
, con);
con.Open();
SqlDataAdapter da =
new
SqlDataAdapter();
DataSet ds =
new
DataSet();
da.SelectCommand = cmd;
da.Fill(ds);
grdRpt.DataSource = ds;
grdRpt.DataBind();
}
protected
void
grdRpt_PageIndexChanging(
object
sender, GridViewPageEventArgs e)
{
grdRpt.PageIndex = e.NewPageIndex;
BindData();
}
when i run the above code output as follows
selectdata transactid transactitemtype transactorgin status
Checkbox 1 123 IVC New
Checkbox 2 245 IVC New
Checkbox 3 345 IVC New
Checkbox 4 645 IVC New
Checkbox 5 723 IVC New
Checkbox 6 445 IVC New
Checkbox 7 545 IVC New
Checkbox 8 923 IVC New
Checkbox 9 245 IVC New
Checkbox 10 845 IVC New
1 2
1 and 2 paging will be there in the gridview
in first page five records will displayed and in the second page another five records will displayed.
suppose in the first page i check two rows and in the second page i check two rows means that selected check box rows to update in the [transact].[transaction_item] in the table.
for that how to do using c#.
Reply
Answers (
2
)
IFrame Error Replicatice in the Iframe
aspboilerplate .net core with jquery projects explaination