.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

How to find grid view asp.net control inside the form view?

Posted By:laptop charles       Posted Date: September 12, 2012    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

find .net controls from grid view inside the form view.
 

I have form view, The form view contains grid view, i wanted to find the .net control inside the grid view.




I have form view, The form view contains grid view, i wanted to find the .net control inside the grid view.


<asp:FormView ID="FormView1" runat="server" SkinID="Detail_FormView" DataKeyNames="StudentID"
                        DataSourceID="sqlClient_View" OnModeChanging="FormView1_ModeChanging">
                        <EditItemTemplate>
                            <table cellpadding="0" cellspacing="1" border="0">
                                <tr>
                                    <td valign="top">
                                        <table>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    FirstName:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtFname" runat="server" Text='<%# Bind("StudentFName") %>' TabIndex="1"
                                                        Height="25px" Width="200" />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                                                        ControlToValidate="txtFname" Display="Dynamic"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    LastName:
                                                </th>
                                                <td>
                                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("StudentLName") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    DOB:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtBirthday" runat="server" Text='<%# Bind("Birthday") %>' Width="200"
                                                        Height="25px" />
                                                    <img src="App_Themes/Soartutoring/images/calendar.gif" id="calendar1" alt="" tabindex="1" />
                                                    <ajax:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtBirthday"
                                                        PopupPosition="Right" Enabled="true" PopupButtonID="calendar1">
                                                    </ajax:CalendarExtender>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    School:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("School") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Grade:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtGrade" runat="server" Text='<%# Bind("Grade") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Parents:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtParents" runat="server" Text='<%# Bind("Parents") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                                                        ControlToValidate="txtParents" Display="Dynamic"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Relationship:
                                                </th>
                                                <td style="width: 450px;">
                                                    <asp:TextBox ID="txtrelationship" Width="200px" runat="server" Text='<%# Bind("Relationship") %>'
                                                        TabIndex="1" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Street Address:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtAddress" runat="server" Text='<%# Bind("Address") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*"
                                                        ControlToValidate="txtAddress" Display="Dynamic"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td valign="top">
                                        <table cellpadding="0" cellspacing="1">
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    City:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="*"
                                                        ControlToValidate="txtCity" Display="Dynamic"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Zip:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtZip" runat="server" Text='<%# Bind("Zip") %>' TabIndex="1" Width="200"
                                                        Height="25px" /><asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
                                                            ErrorMessage="*" ControlToValidate="txtZip" Display="Dynamic"></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Email:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("Email") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Primary Phone:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtPhoneH" runat="server" Text='<%# Bind("PhoneH") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Alternate Phone:
                                                </th>
                                                <td style="width: 300px;">
                                                    <asp:TextBox ID="txtCellphn" runat="server" Text='<%# Bind("Cellphn") %>' TabIndex="1"
                                                        Width="200" Height="25px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Notes:
                                                </th>
                                                <td style="width: 450px;">
                                                    <asp:TextBox ID="txtNotes" Width="200" TextMode="MultiLine" runat="server" Text='<%# Bind("Notes") %>'
                                                        TabIndex="1" Height="50px" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    Free Lunch:
                                                </th>
                                                <td style="width: 450px;">
                                                    <asp:CheckBox ID="chkfreelunch" runat="server" Checked='<%# Bind("FreeLunch") %>'>
                                                    </asp:CheckBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th style="width: 180px; height: 25px;">
                                                    InActive:
                                                </th>
                                                <td>
                                                    <asp:CheckBox ID="chkStatusAdd" Checked='<%# Bind("Status") %>' runat="server"></asp:CheckBox>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td valign="top" width="283" height="330">
                                    
                                        <div class="editschedule">
                                            Edit Schedule</div>
                                        <div id="div2" style="margin-top: 5px; border: 1px solid #ccc; float: right;">
                                            <asp:Button ID="cmd" runat="server" Text="Add More" OnClientClick="return Show_Hide_By_Display()" />
                                        </div>
                                        <div id="div1" style="display: none; border: 1px solid #ccc; margin-top: 3px; width: 280px">
                                            <div style="float: left; width: 35%; margin-right: 10px;">
                                                Day
                                                <asp:DropDownList ID="ddlDays" runat="server" CssClass="dropdownlist" Style="padding: 5px;"
                                                    DataSourceID="sqlddlday" DataTextField="DayName" DataValueField="DayID" Height="27px"
                                                    Width="110px">
                                                </asp:DropDownList>
                                            </div>
                                            <div style="float: left; width: 30%; margin-right: 10px;">
                                                Times
                                                <asp:DropDownList ID="ddlHours" runat="server" CssClass="dropdownlist" Style="padding: 5px;"
                                                    DataSourceID="sqlddltime" DataTextField="Time" DataValueField="TimeID" Height="27px"
                                                    Width="80px">
                                                </asp:DropDownList>
                                            </div>
                                            <div style="float: left; width: 25%; margin-top: 15px;">
                                                <asp:Button ID="btnEditBtn" runat="server" Style="float: left;" Width="70px" Text="Add"
                                                    OnClick="btnEditAdd_Click" />
                                            </div>
                                            <div style="clear: both;">
                                            </div>
                                        </div>
                                        <div>
                                            <%--     Add more --%>
                                    </td>
                                </tr>
                               </table>
   </EditItemTemplate>
  </asp:FormView>



     

Further Readings:

Responses
Author: netgrid         Company URL: http://www.dotnetspark.com
Posted Date: September 21, 2012

Your code is very simple and very effective it help me a lot. I have resolved many suspect even damage databases with it. Keep your good work going. With best wishes.
http://www.dapfor.com/en/net-suite/net-grid/tutorial/data-grouping


Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend