I've been searching everywhere and not found the right combination of what will fix my problem. I have a DetailTables inside a grid, It has the internal Add new record from the CommandItemDisplay and a GridEditCommandColumn. It is using an FormTemplate for Editing and in that formtemplate I have a Label which is filled with the VcnCd from the parent grid. My problem is that when I click on the edit button that label is filled correctly with the VcnCd, but when I click the Add new button that label is empty. I have spent a lot of hours trying to find how to fill that label in the code behind with no luck. the label I'm trying to fill with the correct value is lblvType. I could use some help I'm doing this in VB. Here is my grid.
<telerik:RadGrid ID="grdVcntn" runat="server" AutoGenerateColumns="false"> <ClientSettings> <Scrolling AllowScroll="True" UseStaticHeaders="True" /> </ClientSettings> <MasterTableView EditMode="PopUp" CommandItemDisplay="Top" ShowHeader="true" AutoGenerateColumns="false" DataKeyNames="VcnCd"> <NoRecordsTemplate> There are no records for this person. </NoRecordsTemplate> <CommandItemTemplate> <asp:LinkButton ID="LinkButton1" runat="server" CommandName="InitInsert" > <img style="border:0px" alt="Add" src="../images/plus.gif" /> Add new Record </asp:LinkButton> </CommandItemTemplate> <Columns> <telerik:GridEditCommandColumn ButtonType="imageButton" EditImageUrl="../images/Edit.gif"></telerik:GridEditCommandColumn> <telerik:GridBoundColumn HeaderText="VcnCd" DataField="VcnCd" UniqueName="VcnCd"></telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="VcnNm" DataField="VcnNm" UniqueName="VcnNm"></telerik:GridBoundColumn> </Columns> <EditFormSettings InsertCaption="Add record" CaptionDataField="VcnCd" CaptionFormatString="Edit record: {0}" EditFormType="Template" PopUpSettings-Modal="true" PopUpSettings-Height="260px" PopUpSettings-Width="500px"> <FormTemplate> <table> <tr> <td> Code: <asp:DropDownList ID="dpdVcnCd" DataTextField="VcnNm" DataValueField="VcnCd" SelectedValue='<%# Bind("VcnCd") %>' runat="server" DataSourceID="SqlDataSource1"></asp:DropDownList> </td> </tr> <tr> <td> <asp:Button ID="btnSubmitVcnCd" Text='<%# Iif(typeof Container is GridEditFormInsertItem, "Insert", "Update") %>' runat="server" CommandName='<%# Iif(TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>' CommandArgument='<%# Eval("VcnCd") %>' /> <asp:Button ID="btnCancelVcnCd" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" /> </td> </tr> </table> </FormTemplate> </EditFormSettings> <DetailTables> <telerik:GridTableView Name="DetailTables" EditMode="PopUp" DataKeyNames="ID" DataSourceID="SqlDataSource3" Width="100%" runat="server" CommandItemDisplay="Top"> <ParentTableRelation> <telerik:GridRelationFields DetailKeyField="VcnCd" MasterKeyField="VcnCd" /> </ParentTableRelation> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="../images/Edit.gif" UniqueName="Edit"></telerik:GridEditCommandColumn> <telerik:GridBoundColumn HeaderText="ID" DataField="ID" UniqueName="ID"></telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="VcnCd" DataField="VcnCd" UniqueName="VcnCd"></telerik:GridBoundColumn> <telerik:GridBoundColumn HeaderText="Date" DataField="VcntnDt" UniqueName="VcntnDt" DataFormatString="{0:d}"></telerik:GridBoundColumn> </Columns> <EditFormSettings InsertCaption="Edit Item" CaptionFormatString="Edit ID: {0}" CaptionDataField="ID" EditFormType="Template" PopUpSettings-Modal="true" PopUpSettings-Height="260px" PopUpSettings-Width="400px"> <PopUpSettings Modal="true" /> <EditColumn UniqueName="EditCommandColumn1" ButtonType="ImageButton" InsertImageUrl="../images/plus.gif" EditImageUrl="../images/Edit.gif"></EditColumn> <FormTemplate> <table id="tblEditVcnDte"> <tr> <td colspan="2" align="left">Vaccination Type: <asp:Label ID="lblvType" Text='<%# Bind("VcnCd") %>' runat="server"></asp:Label></td> </tr> <tr> <td align="right">Date :</td> <td> <asp:TextBox ID="txtVcnDte" runat="server" Text='<%# Bind("VcntnDt","{0:d}") %>'></asp:TextBox> </td> </tr> </table> <table style="width: 100%"> <tr> <td align="right" colspan="2"> <asp:Button ID="btnSubmitVcn" Text='<%# Iif(typeof Container is GridEditFormInsertItem, "Insert", "Update") %>' runat="server" CommandName='<%# Iif(TypeOf Container is GridEditFormInsertItem, "InsertCdDt", "UpdateCdDt") %>' CommandArgument='<%# Eval("ID") %>' /> <asp:Button ID="btnCancelVcn" Text="Cancel" runat="server" CausesValidation="false" CommandName="Cancel" /> </td> </tr> </table> </FormTemplate> </EditFormSettings> </telerik:GridTableView> </DetailTables> </MasterTableView> <ClientSettings> <ClientEvents OnPopUpShowing="PopUpShowing" /> <Selecting AllowRowSelect="true" /> </ClientSettings></telerik:RadGrid>