Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Navin Gada   on Nov 22 In Asp.net Category.

  
Question Answered By: Ada Bailey   on Nov 22

if I have a datagrid  and the last Column is an Iten
Template with check  Boxes.
Now at the Click of a Button which is not the part
of
the datagrid,I want
the values  of all the checkboxes  which were Clicked
what code  should I insert


Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load

StyleSheetURL.Attributes.Add("href",
getStyleSheetPath())
LoadBookGrid()
End Sub
Sub LoadBookGrid()
Dim Conn As Object ' SqlConnection
Dim Comm As Object ' SqlCommand
Dim DataRdr As Object ' SqlDataReader
'Dgrd_Books.PagerStyle.Mode =
PagerMode.NumericPages
InitializeDBObjects(Conn, Comm)

Conn.Open()
Comm.Connection = Conn
Comm.CommandText = "select * from
LibraryMaster"
DataRdr =
Comm.ExecuteReader(CommandBehavior.SequentialAccess)

Dgrd_Books.DataSource = DataRdr
Dgrd_Books.DataBind()
End Sub

Private Sub Sub_Choose_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Sub_Choose.Click
Dim i As Integer
For i = 0 To Dgrd_Books.Items.Count()

Next
End Sub 'This is the Button onClick


'The datagrid with Check boxes  in the thrid Column

<asp:DataGrid id="Dgrd_Books" OnItemDataBound =
"populateCheckBoxes"
style="Z-INDEX: 101; LEFT: 17px; POSITION: absolute;
TOP: 13px" runat="server" CellPadding="1"
CellSpacing="1" Font-Size="Small"
AutoGenerateColumns="False"
AlternatingItemStyle-BackColor="LightGrey"
AllowPaging="false" >
<AlternatingItemStyle
BackColor="LightGray"></AlternatingItemStyle>
<Columns>
<Asp:TemplateColumn HeaderText="S.No"
ItemStyle-HorizontalAlign="right">
<ItemTemplate>
</ItemTemplate>
</Asp:TemplateColumn>

<asp:BoundColumn DataField="ISBN"
HeaderText="ISBN">
<HeaderStyle Font-Size="7pt"></HeaderStyle>
<ItemStyle Font-Size="7pt"></ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="Title"
HeaderText="Title">
<HeaderStyle Font-Size="8pt"></HeaderStyle>
<ItemStyle Font-Size="8pt"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:checkBox id="chkBook" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<asp:Button id="Sub_Choose" style="Z-INDEX: 102;
LEFT: 22px; POSITION: absolute; TOP: 331px"
runat="server" Text="Submit" Width="114px"
Height="29px"></asp:Button>

Share: 

 
 
Didn't find what you were looking for? Find more on CheckBoxes in DataGrid Or get search suggestion and latest updates.


Tagged: