How to get controls in InsertItemTemplate to show in a GridView
I consider myself at intermediate level with the GridView. So far my understanding of it has come pretty easy to me, that is until I think I need to use the InsertItemTemplate. I could use the Footer to do my "add new" record but I have 19 fields I need the user to enter data into, I want to put it all into one column formatted using a . It works and looks great in the EditItemTemplate and the EmptyDataTemplate. I just can't figure out how to get the controls in the InsertItemTemplate to show. If I could figue out how to format the Footer to only show/use one wide column with my I would use that because I understand the Footer and have used it a lot up to this point.
Any way, here's my grid. I apologize for the size. There are a lot of fields.
<InsertItemTemplate>
<table width="100%" class="tdSilver" id="tblAdd">
<tr>
<th style="width: 15%; text-align: left">
<asp:Label runat="server" ID="lbllocationName_add" Text="Location Name" />
</th>
<th style="width: 20%; text-align: left">
<asp:Label runat="server" ID="lblassType_add" Text="Review Type" />
</th>
<th style="width: 20%; text-align: left">
<asp:Label runat="server" ID="lblrelatedCISE" Text="Related CISE" />
</th>
</tr>
<tr class="altRow">
<td align="left">
<asp:TextBox runat="server" ID="txtlocationName_add" Text="" Width="85%" MaxLength="200" />
<br />
<asp:RequiredFieldValidator runat="server" ID="vallocationName_add" ControlToValidate="txtlocationName_add"
ErrorMessage="Location Name Required" Font-Bold="true" ForeColor="Red" Display="Dynamic" />
</td>
<td align="left">
<asp:DropDownList runat="server" ID="ddlassTypeId_add" DataTextField="assType" DataValueField="assTypeId"
Width="85%" />
<br />
<asp:RequiredFieldValidator ID="valddlassTypeId_add" runat="server" ControlToValidate="ddlassTypeId_add"
InitialValue="-1" Display="Dynamic" ErrorMessage="Required" Font-Bold="true"
ForeColor="Red" />
</td>
<td align="left">
<asp:DropDownList runat="server" ID="ddlrelatedCISE_add" DataTextField="assType"
DataValueField="assTypeId" Width="85%" />
<br />
<asp:RequiredFieldValidator ID="valddlrelatedCISE_add" runat="server" ControlToValidate="ddlrelatedCISE_add"
InitialValue="-1" Display="Dynamic" ErrorMessage="Required" Font-Bold="true"
ForeColor="Red" />
</td>
</tr>
<tr>
<th style="text-align: left">
<asp:Label runat="server" ID="lblvendorLocationTypeId_add" Text="Site Type" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lbllocationDesc_add" Text="Site Description" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblcancelled_add" Text="Site Cancelled" />
</th>
</tr>
<tr class="altRow">
<td valign="top" align="left">
<asp:DropDownList runat="server" ID="ddlvendorLocationTypeId_add" DataTextField="vendorLocationType"
DataValueField="vendorLocationTypeId" Width="85%" />
<br />
<asp:RequiredFieldValidator ID="valddlvendorLocationTypeId_add" runat="server" ControlToValidate="ddlvendorLocationTypeId_add"
InitialValue="0" Display="Dynamic" ErrorMessage="Required" Font-Bold="true" ForeColor="Red" />
</td>
<td align="left">
<asp:TextBox runat="server" ID="txtlocationDesc_add" Text="" TextMode="MultiLine"
MaxLength="500" Rows="4" Width="85%" />
<br />
<asp:CustomValidator ID="valtxtlocationDesc_add" runat="server" ErrorMessage="Max length of Location Desc exceeded 500 characters."
Font-Strikeout="False" ControlToValidate="txtlocationDesc_add" SetFocusOnError="True"
OnServerValidate="MaxLengthTest" Font-Bold="True" Display="Dynamic"></asp:CustomValidator>
</td>
<td valign="top" align="left">
<asp:CheckBox runat="server" ID="chbcancelled_add" Text="Site Cancelled" AutoPostBack="False"
CssClass="ispaCheckBoxes" Font-Bold="false" Width="85%" onclick="ToggleCancelledWarning();" />
<br />
<asp:Label ID="lblCancelledReason_add" runat="server" Text="Reason for Cancellation" />
<br />
<asp:TextBox ID="txtCancelledReason_add" runat="server" Text="" TextMode="MultiLine"
Rows="3" Width="85%" onchange="ToggleCancelledWarning();" />
<br />
<asp:CustomValidator ID="valtxtCancelledReason_add" runat="server" ErrorMessage="Max length of Reason exceeded 500 characters."
Font-Strikeout="False" ControlToValidate="txtCancelledReason_add" SetFocusOnError="True"
OnServerValidate="MaxLengthTest" Font-Bold="True" Display="Dynamic"></asp:CustomValidator>
<br />
<asp:Label runat="server" ID="lblCancelledReasonWarning" Text="" Font-Bold="true"
ForeColor="Red" Visible="true" />
</td>
</tr>
<tr>
<th style="text-align: left">
<asp:Label runat="server" ID="lblsiteScopeId_add" Text="Site Scope" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblapplicationName_add" Text="Application Name" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblapplicationURL_add" Text="Application URL" />
</th>
</tr>
<tr class="altRow">
<td valign="top" align="left">
<asp:DropDownList runat="server" ID="ddlsiteScopeId_add" DataTextField="siteScopeName"
DataValueField="siteScopeId" Width="85%" />
<br />
<asp:RequiredFieldValidator ID="valddlsiteScopeId_add" runat="server" ControlToValidate="ddlsiteScopeId_add"
InitialValue="0" Display="Dynamic" ErrorMessage="Required" Font-Bold="true" ForeColor="Red" />
</td>
<td align="left">
<asp:TextBox runat="server" ID="txtapplicationName_add" Text="" Width="85%" MaxLength="100" />
</td>
<td align="left">
<asp:TextBox runat="server" ID="txtapplicationURL_add" Text="" Width="85%" MaxLength="100" />
</td>
</tr>
<tr>
<th style="text-align: left">
<asp:Label runat="server" ID="lblvendorStreet_add" Text="Street" />
</th>
<th style="text-align: left">
<asp:Label runat="server" ID="lblvendorCity_add" Text="City" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblvendorZip_add" Text="Zip" />
</th>
</tr>
<tr class="altRow">
<td align="left">
<asp:TextBox runat="server" ID="txtvendorStreet_add" Text="" Width="85%" MaxLength="100" />
<br />
<asp:RequiredFieldValidator ID="valtxtvendorStreet_add" runat="server" ControlToValidate="txtvendorStreet_add"
Display="Dynamic" ErrorMessage="Required" Font-Bold="true" ForeColor="Red" />
</td>
<td align="left">
<asp:TextBox runat="server" ID="txtvendorCity_add" Text="" Width="85%" MaxLength="100" />
<br />
<asp:RequiredFieldValidator ID="valtxtvendorCity_add" runat="server" ControlToValidate="txtvendorCity_add"
Display="Dynamic" ErrorMessage="Required" Font-Bold="true" ForeColor="Red" />
</td>
<td align="left">
<asp:TextBox runat="server" ID="txtvendorZip_add" Text="" Width="85%" MaxLength="20" />
</td>
</tr>
<tr>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblvendorProvidence_add" Text="Providence" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblstateId_add" Text="State" />
</th>
<th style="text-align: left">
<asp:Label runat="server" ID="lblcountryId_add" Text="Country" />
</th>
</tr>
<tr class="altRow">
<td align="left">
<asp:TextBox runat="server" ID="txtvendorProvidence_add" Text="" Width="85%" MaxLength="100" />
</td>
<td align="left">
<asp:DropDownList ID="ddlstateId_add" runat="server" Width="85%" DataTextField="stateAbbv"
DataValueField="stateId" />
</td>
<td align="left">
<asp:DropDownList runat="server" ID="ddlcountryId_add" DataTextField="countryName"
DataValueField="countryId" Width="85%" />
<br />
<asp:RequiredFieldValidator ID="valddlcountryId_add" runat="server" ControlToValidate="ddlcountryId_add"
InitialValue="0" Display="Dynamic" ErrorMessage="Required" Font-Bold="true" ForeColor="Red" />
</td>
</tr>
<tr>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblfieldAssessorUsrId_add" Text="Assign Field Assessor" />
</th>
<th style="text-align: left; fon开发者_运维技巧t-weight: normal">
<asp:Label runat="server" ID="lblreviewStartDate_add" Text="Arrive On" />
</th>
<th style="text-align: left; font-weight: normal">
<asp:Label runat="server" ID="lblreviewEndDate_add" Text="Depart On" />
</th>
</tr>
<tr class="altRow">
<td align="left">
<asp:DropDownList runat="server" ID="ddlfieldAssessorUsrId_add" DataTextField="usrFullName"
DataValueField="usrID" Width="85%" />
</td>
<td style="vertical-align: text-top; text-align: left">
<telerik:RadDatePicker runat="server" ID="dtereviewStartDate_add" Calendar-EnableMultiSelect="False"
Calendar-EnableMonthYearFastNavigation="True" Width="85%" />
</td>
<td style="vertical-align: text-top; text-align: left">
<telerik:RadDatePicker runat="server" ID="dtereviewEndDate_add" Calendar-EnableMultiSelect="False"
Calendar-EnableMonthYearFastNavigation="True" Width="85%" />
</td>
</tr>
<tr>
<td colspan="3" style="text-align: left">
<asp:LinkButton ID="lnkBtnAdd_add" runat="server" Text="Insert New" CommandName="EmptyInsert"
CausesValidation="True"></asp:LinkButton>
</td>
</tr>
</table>
</InsertItemTemplate>
I couldn't figure this out and so I put the "insert" feature in a panel outside the grid and populated it that way. Works fine. Wish I didn't have to do that. Oh well.
精彩评论