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
747
1.2k
282.5k
Passing 2 parameters in the command argument in a Gridview
Aug 21 2018 2:12 AM
Can anyone teach me how to pass the 2nd parameter in the command argument in c#? I tried the code below but it only passes the 1st parameter to the 2 command argument.
protected
void
gvLessonPlan_RowCommand(
object
sender, GridViewCommandEventArgs e)
{
string
id = lblDeledtedId.Text;
if
(e.CommandName ==
"DeleteRow"
)
{
LessonPlanDataAccess.DeleteLessonPlan(Convert.ToString(e.CommandArgument), Convert.ToString(e.CommandArgument));
int
user = Convert.ToInt32(lblID.Text);
string
activity =
"deleted lesson plan entry with id "
+ id;
SIBSAdminDataAccess.InsertAuditTrail(activity, user);
getLessonPlan();
}
}
protected
void
LinkButton1_Click(
object
sender, EventArgs e)
{
GridViewRow row = (GridViewRow)((LinkButton)sender).NamingContainer;
Label lblId = row.FindControl(
"lblId"
)
as
Label;
Label COHeaderId = row.FindControl(
"lblCOHeaderId"
)
as
Label;
lblDeledtedId.Text = lblId.Text;
lblDeletedCoHeader.Text = COHeaderId.Text;
}
Below is my mark-up
<
Columns
>
<
asp:TemplateField
HeaderText
=
"Lesson Plan Id"
SortExpression
=
"LPId"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
Text
=
'<%# Bind("LPId") %>'
>
</
asp:TextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblId"
runat
=
"server"
Text
=
'<%# Bind("LPId") %>'
>
</
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
DataField
=
"GLCode"
HeaderText
=
"Grade Level"
SortExpression
=
"GLCode"
/>
<
asp:BoundField
DataField
=
"SubCode"
HeaderText
=
"Subject"
SortExpression
=
"SubCode"
/>
<
asp:BoundField
DataField
=
"WeekNo"
HeaderText
=
"WeekNo"
SortExpression
=
"WeekNo"
/>
<
asp:BoundField
DataField
=
"InclusiveDate"
HeaderText
=
"InclusiveDate"
SortExpression
=
"InclusiveDate"
/>
<
asp:BoundField
DataField
=
"FullName"
HeaderText
=
"FullName"
SortExpression
=
"FullName"
/>
<
asp:TemplateField
HeaderText
=
"COHeaderId"
SortExpression
=
"COHeaderId"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"TextBox2"
runat
=
"server"
Text
=
'<%# Bind("COHeaderId") %>'
>
</
asp:TextBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblCOHeaderId"
runat
=
"server"
Text
=
'<%# Bind("COHeaderId") %>'
>
</
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Is Lectured"
SortExpression
=
"IsLectured"
>
<
ItemTemplate
>
<
span
onclick
=
"return confirm('Are you sure you want to delete? This cannot be undone.')"
>
<
asp:LinkButton
ID
=
"LinkButton1"
runat
=
"server"
CommandArgument
=
'<%# Eval("LPId") %>'
CommandName
=
"DeleteRow"
CssClass
=
"btn btn-danger"
OnClick
=
"LinkButton1_Click"
>
Delete
</
asp:LinkButton
>
</
span
>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
Thanks in advance.
Reply
Answers (
1
)
How to Fiddler Tool Test API Upload File withOther Parameter
Why Migrations are not using EntityTypeConfiguration?