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
mary jean ligas
NA
420
196.8k
Check/Uncheck Checkboxes using linkbutton header template inside gridview
Dec 3 2012 10:22 PM
Hello Everyone please help me I am new to this programming language
I want to create A GRIDVIEW that will Check/Uncheck Checkboxes using linkbutton header template inside gridview..Is it posible..
Thanks here's my code
CODE BEHIND:
protected void lnkInitiator_Click(object sender, EventArgs e)
{
bool chkboxIsChecked = false;
for (int i = 0; i < gridRevAppMatrix.Rows.Count; i++)
{
foreach (GridViewRow row in gridRevAppMatrix.Rows)
{
string AppID = (gridRevAppMatrix.DataKeys[row.RowIndex].Values["MatrixCondition_Idx"].ToString());
chkboxIsChecked = false;
CheckBox selected = (CheckBox)gridRevAppMatrix.Rows[i].FindControl("chkInitiator");
if ((selected.Checked == true) && (selected != null))
{
chkboxIsChecked = false;
RoleSavingReg(getRole("chkInitiator"), AppID, chkboxIsChecked);
}
else
{
chkboxIsChecked = true;
RoleSavingReg(getRole("chkInitiator"), AppID, chkboxIsChecked);
}
}
}
}
CLIENT SIDE:
<asp:TemplateField>
<HeaderStyle BackColor="#0070C0" CssClass="TimeAssigned" ForeColor="white" Font-Italic="false" Font-Bold="true" HorizontalAlign="Center" Width="50px"/>
<HeaderTemplate>
<asp:LinkButton ID="lnkInitiator" runat="server" CssClass="LinkHeader" OnClick="lnkInitiator_Click">Initiator</asp:LinkButton>
</HeaderTemplate>
<ItemTemplate>
<center>
<asp:CheckBox runat="server" id="chkInitiator" OnDataBinding="chkInitiator_DataBinding" OnCheckedChanged="chkInitiator_CheckedChanged" AutoPostBack="true" /></center>
</ItemTemplate>
</asp:TemplateField>
I really appreciate your big help on this thanks
Reply
Answers (
1
)
Simple C# Game Question
Serial port not read data