Skip to content

How to edit the rows when the chkbox is selected?

Ki Ki

Ki Ki

Asked Jan 8, 2013, 11:14 PM EST2 answers
Share
LinkedInX
I am having a Gridview where there is a checkbox and few other columns. The checkbox and the ID column is frozen while the other columns like vendor type,style id are not frozen.

My requirement is that when i check the chkbox,all other columns,except the frozen ones  in the selected row should change to edit mode.

Since the 1st few column is frozen,if i add an edit button there will be some overlapping and the entire gridview structure gets misplaced.

Please reply asap.

PFB the code.


<asp:GridView ID="gvMachinegrid" runat="server" AutoGenerateColumns="False"
OnRowDataBound="gvMachinegrid_RowDataBound" DataKeyNames="StyleColorChangeTypeId"
DataSourceID="SqlDataSource1" class="FixedTables">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="SelectAllCheckBox" runat="server" onclick="SelectAll(this)" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged="chkSelect_checkedchanged" AutoPostBack="true"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="StyleColorChangeTypeId" HeaderText="ID" >
</asp:BoundField>
<asp:BoundField DataField="StyleId" HeaderText="StyleId">
</asp:BoundField>
<asp:BoundField DataField="ChangeTypeId" HeaderText="ChangeTypeId">
</asp:BoundField>
<asp:BoundField DataField="Vendor" HeaderText="Vendor">
</asp:BoundField>
</Columns>
<PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast"
NextPageText="First" PreviousPageText="Last" />
<PagerStyle />
</asp:GridView>

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Vithal Wadje
    0
    just a use the code on checkbox checked event as you simmilary used on button cliclk to edit the grid
    0
  • Ki Ki
    0
    The entire gridview structure gets misplaced. Sorry i am new to c#..
    0