Data controls

Last Reply on Apr 11, 2012 09:55 AM By vinayak

Posted on Apr 11, 2012 08:34 AM

my code is

 

 

<table>
                   <tr>
                        <td >
                            <asp:Label ID="LblName" runat="server" Text="Name"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtName" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                             ControlToValidate = "TxtName"></asp:RequiredFieldValidator>
                         </td>
                        <td>
                            <asp:Label ID="LblCName" runat="server" Text="Company Name"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtCName" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                            ControlToValidate = "TxtCName"></asp:RequiredFieldValidator>
                        </td>                      
                   </tr>
                  
                   <tr>
                        <td>
                            <asp:Label ID="LblMobileNo" runat="server" Text="Mobile No."></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtMNo" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*"
                            ControlToValidate="TxtMNo"></asp:RequiredFieldValidator>
                             <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" TargetControlID="TxtMNo" FilterType="Numbers"></cc1:FilteredTextBoxExtender>
                        </td>                    
                        <td>
                            <asp:Label ID="LblLLNo" runat="server" Text="LandLine No."></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtLLNo" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*"
                            ControlToValidate="TxtLLNo"></asp:RequiredFieldValidator>
                            <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtLLNo" FilterType="Numbers"></cc1:FilteredTextBoxExtender>
                        </td>

                   </tr>

                   <tr >
                        <td style="text-align:center;" colspan="4">
                             <font style="font-style:oblique; font-weight:bold; font-size:19px;"> Enter Your Address </font>
                        </td>
                  
                   </tr>

                   <tr>
                        <td>
                        <asp:Label ID="LblAddress" runat="server" Text="Address"></asp:Label>
                      </td>
                        <td>
                          <asp:TextBox ID="TxtAddress" runat="server"></asp:TextBox>
                          <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*"
                          ControlToValidate="TxtAddress"></asp:RequiredFieldValidator>
                          </td>
                        <td>
                            <asp:Label ID="LblStreet" runat="server" Text="Street"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtStreet" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="*"
                            ControlToValidate="TxtStreet"></asp:RequiredFieldValidator>
                        </td>
                    </tr>

                   <tr>
                        <td>
                          <asp:Label ID="LblCity" runat="server" Text="City"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtCity" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="*"
                            ControlToValidate="TxtCity"></asp:RequiredFieldValidator>
                        </td>
                        <td>
                            <asp:Label ID="LblState" runat="server" Text="State"></asp:Label>
                        </td>
                        <td>
                            <asp:TextBox ID="TxtState" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="*"
                            ControlToValidate="TxtState"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                
                   <tr>
                      <td>
                        <asp:Label ID="LblPCode" runat="server" Text="Pin code"></asp:Label>
                      </td>
                      <td>
                          <asp:TextBox ID="TxtPCode" runat="server"></asp:TextBox>
                          <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ErrorMessage="*"
                          ControlToValidate="TxtPCode"  ></asp:RequiredFieldValidator>
                          <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPCode" FilterType="Numbers"></cc1:FilteredTextBoxExtender>
                      </td>
                      <td>
                          <asp:Label ID="LblEMail" runat="server" Text="Email Address"></asp:Label>
                      </td>
                      <td>
                           <asp:TextBox ID="TxtEMail" runat="server"></asp:TextBox>
                             <asp:RegularExpressionValidator id="Email" runat="server"
                                ControlToValidate="txtEmail"
                                ValidationExpression=".*@.*\..*"
                                ErrorMessage="*Invalid Email."
                                Display="dynamic">
                             </asp:RegularExpressionValidator>
                          
                        </td>
                    </tr>

                   <tr >
                        <td style="text-align:center;" colspan="4">
                             <font style="font-style:oblique; font-weight:bold; font-size:19px;"> Products</font>
                        </td>
                  
                   </tr>                   

                   <tr>
                        <td>
                           <asp:Label ID="LblCDate" runat="server" Text="Current Date:"></asp:Label>
                        </td>
                        <td>
                        <asp:ScriptManager runat ="server" ></asp:ScriptManager>
                            <asp:TextBox ID="TxtCDate" runat="server"></asp:TextBox><image id="calender1" src="images/calender1.jpg" alt="ccc" ></image>
                            <cc1:CalendarExtender ID="CalendarExtender1" runat="server"  format="dd/MM/yy" PopupButtonID="calender1"
                                PopupPosition="BottomRight" TargetControlID="TxtCDate">
                             
                            </cc1:CalendarExtender>
                           
                          
                        </td>
                        <td>
                           <asp:Label ID="LblDDate" runat="server" Text="Delivery Date:"></asp:Label>
                        </td>
                        <td>
                       
                            <asp:TextBox ID="TxtDDate" runat="server"></asp:TextBox><image id="calender2" src="images/calender1.jpg" alt="ccc" ></image>
                            <cc1:CalendarExtender ID="CalendarExtender2" runat="server"  format="dd/MM/yy" PopupButtonID="calender2"
                                PopupPosition="BottomRight" TargetControlID="TxtDDate">
                            </cc1:CalendarExtender>
                        </td>
                   </tr>

                   <tr>
                        <td >
                            <asp:Label ID="LblPName" runat="server" Text=" Product Name"></asp:Label>
                        </td>
                        <td>
                                <asp:DropDownList ID="DropDownList1" runat="server">
                                   
                                      <asp:ListItem Text="Agro Water"></asp:ListItem>
                                      <asp:ListItem Text="Aquarium Water"></asp:ListItem>
                                       <asp:ListItem Text="Batteries Distilled Water"></asp:ListItem>
                                       <asp:ListItem Text="Car  Wiper Water"></asp:ListItem>
                                        <asp:ListItem Text="Dental  Water"></asp:ListItem>
                                        <asp:ListItem Text="House Hold Water"></asp:ListItem>
                                        <asp:ListItem Text="Industrial Water"></asp:ListItem>
                                        <asp:ListItem Text="Laboratory Water"></asp:ListItem>
                                        <asp:ListItem Text="Radiator Water"></asp:ListItem>
                                         <asp:ListItem Text="Saloon Distilled Water"></asp:ListItem>
                                        
                                </asp:DropDownList>
                        </td>
                        <td>
                            <asp:Label ID="LblQuantity" runat="server" Text="Quantity"></asp:Label>
                        </td>                      
                        <td>
                        <asp:TextBox ID="TxtQty" runat="server"></asp:TextBox>
                        <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtQty" FilterType="Numbers"></cc1:FilteredTextBoxExtender>
                        Liters.
                         </td>
                      
                   </tr>
                   <tr>
                        <td colspan="4">
                        <asp:Button ID="Cart" runat="server" Text="Add to Cart" />
                        </td>
                   </tr>

                   <tr>
                        <td colspan="4">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
                            CellPadding="4" ForeColor="#333333" GridLines="None">
                           <AlternatingRowStyle BackColor="White" />
                           <Columns>
                                 <asp:BoundField DataField="Number" HeaderText="Sr No." ReadOnly="True" SortExpression="Number" />
                                 <asp:BoundField DataField="Var Char2" HeaderText="Product Name" ReadOnly="True" SortExpression="Var Char2" />
                                 <asp:BoundField DataField="int" HeaderText="Quantity" ReadOnly="True" SortExpression="int" />
                                 <asp:BoundField DataField="Date" HeaderText="Current Date" ReadOnly="True" SortExpression="Date" />
                                 <asp:BoundField DataField="Date" HeaderText="Order Date" ReadOnly="True"  SortExpression="Date" />
                             </Columns>
                           <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                           <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                           <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                           <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                           <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                           <SortedAscendingCellStyle BackColor="#FDF5AC" />
                           <SortedAscendingHeaderStyle BackColor="#4D0000" />
                           <SortedDescendingCellStyle BackColor="#FCF6C0" />
                           <SortedDescendingHeaderStyle BackColor="#820000" />
                       </asp:GridView>
                        </td>
                   </tr> <%--GridView--%>
               
            </table>

if i click add to cart button the the details of this page must be displayed in grid view

tell me wt i should do.

You are viewing reply posted by: vinayak on Apr 11, 2012 09:55 AM.
Posted on Apr 11, 2012 09:55 AM

on page load bind grid with database table .

after every click save data and redirect on same page