Hello everyone! I wanna know If how will I get the values from the selected checkboxes of my datagridview, the values of the textboxes on the right and how will i put the selected values in a Session?

thanks in advance! heres the pic of my project.
http://i53.tinypic.com/2cz7z2o.jpg

DataGridView is a winform control. Please post your code here so we can provide better help.

here's my code

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="gridstyle"
                                DataSourceID="AccessDataSource1" Font-Names="Calibri" Font-Size="14px" GridLines="None"
                                Width="500px" DataKeyNames="RoomCode">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <center>
                                                <asp:CheckBox ID="CheckBox1" runat="server" />
                                            </center>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField Visible="False" DataField="RoomCode" HeaderText="Room Code" ReadOnly="True"
                                        SortExpression="RoomCode">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="RoomName" HeaderText="Rooms" SortExpression="RoomName">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="RoomNumberAvailable" HeaderText="No. of Available Rooms"
                                        ReadOnly="True" SortExpression="RoomNumberAvailable">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            No of Rooms to Lodge
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <center>
                                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                            </center>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <PagerStyle ForeColor="#053769" />
                                <HeaderStyle BackColor="#E1E2FA" ForeColor="#053769" />
                            </asp:GridView>
                            <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Blue Coral DB.mdb"
                                SelectCommand="SELECT * FROM RoomList"></asp:AccessDataSource>

here's my code

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CssClass="gridstyle"
                                DataSourceID="AccessDataSource1" Font-Names="Calibri" Font-Size="14px" GridLines="None"
                                Width="500px" DataKeyNames="RoomCode">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <center>
                                                <asp:CheckBox ID="CheckBox1" runat="server" />
                                            </center>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField Visible="False" DataField="RoomCode" HeaderText="Room Code" ReadOnly="True"
                                        SortExpression="RoomCode">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="RoomName" HeaderText="Rooms" SortExpression="RoomName">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:BoundField DataField="RoomNumberAvailable" HeaderText="No. of Available Rooms"
                                        ReadOnly="True" SortExpression="RoomNumberAvailable">
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:BoundField>
                                    <asp:TemplateField>
                                        <HeaderTemplate>
                                            No of Rooms to Lodge
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <center>
                                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                            </center>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <PagerStyle ForeColor="#053769" />
                                <HeaderStyle BackColor="#E1E2FA" ForeColor="#053769" />
                            </asp:GridView>
                            <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Blue Coral DB.mdb"
                                SelectCommand="SELECT * FROM RoomList"></asp:AccessDataSource>
Dim i As Integer
        For i = 0 To GridView1.Rows.Count - 1
            Dim chk As CheckBox = CType(GridView1.Rows(i).Cells(0).FindControl("CheckBox1"), CheckBox)
            If chk.Checked Then
                '
            End If
        Next

I will suggest you to use RowDataBound even of griedview where you can cath each row of gridview and use FindControl method in this event.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.