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
Jes Sie
736
1.2k
284.3k
Get The Value of a Gridview Using a Checkbox and Save in DB
Dec 10 2017 11:30 PM
Once again I need some assistance.
I have a gridview where its data comes from a certain table in my database. In the gridview, I added a checkbox. Once the checkbox is checked, the value of the
ClauseCode
will be saved in another table in my database. The sad part is that I don't know how to do it. Below is my markup:
<
asp:GridView
ID
=
"gvClauses"
runat
=
"server"
BackColor
=
"White"
BorderColor
=
"#999999"
BorderStyle
=
"Solid"
BorderWidth
=
"1px"
CellPadding
=
"3"
ForeColor
=
"Black"
GridLines
=
"Vertical"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"ClauseCode"
>
<
AlternatingRowStyle
BackColor
=
"#CCCCCC"
/>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"ClauseID"
InsertVisible
=
"False"
SortExpression
=
"ClauseID"
>
<
EditItemTemplate
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
'<%# Eval("ClauseID") %>'
>
asp:Label
>
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
'<%# Bind("ClauseID") %>'
>
asp:Label
>
ItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"ClauseCode"
SortExpression
=
"ClauseCode"
>
<
EditItemTemplate
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
Text
=
'<%# Eval("ClauseCode") %>'
>
asp:Label
>
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblClauseCode"
runat
=
"server"
Text
=
'<%# Bind("ClauseCode") %>'
>
asp:Label
>
ItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"ClauseDescription"
SortExpression
=
"ClauseDescription"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
Text
=
'<%# Bind("ClauseDescription") %>'
>
asp:TextBox
>
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
Text
=
'<%# Bind("ClauseDescription") %>'
>
asp:Label
>
ItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Wordings"
SortExpression
=
"Wordings"
Visible
=
"False"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"TextBox2"
runat
=
"server"
Text
=
'<%# Bind("Wordings") %>'
>
asp:TextBox
>
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Label4"
runat
=
"server"
Text
=
'<%# Bind("Wordings") %>'
>
asp:Label
>
ItemTemplate
>
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Select"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"cbSelect"
runat
=
"server"
OnCheckedChanged
=
"cbSelect_CheckedChanged"
/>
ItemTemplate
>
asp:TemplateField
>
Columns
>
<
FooterStyle
BackColor
=
"#CCCCCC"
/>
<
HeaderStyle
BackColor
=
"Black"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
PagerStyle
BackColor
=
"#999999"
ForeColor
=
"Black"
HorizontalAlign
=
"Center"
/>
<
SelectedRowStyle
BackColor
=
"#000099"
Font-Bold
=
"True"
ForeColor
=
"White"
/>
<
SortedAscendingCellStyle
BackColor
=
"#F1F1F1"
/>
<
SortedAscendingHeaderStyle
BackColor
=
"#808080"
/>
<
SortedDescendingCellStyle
BackColor
=
"#CAC9C9"
/>
<
SortedDescendingHeaderStyle
BackColor
=
"#383838"
/>
asp:GridView
>
I tried to search in google for several hours but I haven't found a requirement the same as mine. Hope someone can assist me. Thanks in advance.
Reply
Answers (
1
)
ASP.NET MVC 5 Custom validation Attribute are not firing
Request.QueryString[] is not taking Parameter values.