This is a migrated thread and some comments may be shown as answers.

[Solved] Edit Template parameters

7 Answers 284 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 04 Dec 2009, 06:51 PM
I have a radgrid with a custom edit form. I have several controls in the edit form ie: Radeditor,Dropdownlist etc.... the problem I am having is with my dropdownlist I need to fill the list from sql based on the "dictationid" of the record being edited. I cant seem to get the value of the dictationid as a parameter for the Dropdownlist SQL Query. How do I get this value? BTW the dictationid is the Datakeyname for this radgrid.

7 Answers, 1 is accepted

Sort by
0
Rob T
Top achievements
Rank 1
answered on 04 Dec 2009, 07:19 PM
Robert,

Could you post your radgrid code?
0
Robert
Top achievements
Rank 1
answered on 04 Dec 2009, 08:15 PM
Sure here you go

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Transcription.aspx.vb" Inherits="Transcription" %> 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
    <style type="text/css">  
        .style1  
        {  
            text-align: left;  
        }  
        .style2  
        {  
            width: 929px;  
        }  
        </style> 
   
 
</head> 
<body background="Images/bg-fade.gif">  
    <form id="form1" runat="server">  
      
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">  
    </telerik:RadStyleSheetManager> 
    <div> 
      
        <div class="style1">  
            <hr width="100%" /> 
            <asp:Image ID="Image1" runat="server"   
                ImageUrl="~/Images/Transcriptionheader.png" /> 
        </div> 
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">  
        </telerik:RadScriptManager> 
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" Skin="Hay"   
            DecoratedControls="All" /> 
    </div> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
          
          
        SelectCommand="SELECT Dictations.Dictationid, Dictations.Dictatorid, Dictations.Jobstate, Dictations.AssignedTranID, Dictations.PriorityLevel, Dictations.Worktype, Dictations.Datedictated, Dictations.DateUploaded, Dictations.[Document], Users.FirstName + ' ' + Users.Lastname AS Dictator, Users.Groupid FROM Dictations INNER JOIN Users ON Dictations.Dictatorid = Users.Userid"   
          
        UpdateCommand="Update dictations set Document =@content ">  
        <UpdateParameters> 
            <asp:Parameter Name="content" /> 
        </UpdateParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
        SelectCommand="SELECT BillingID, Dictationid, ICD9ID, CPTID, ICD9parentid FROM Dictation_Billingcodes WHERE (Dictationid = @dictationid)">  
        <SelectParameters> 
            <asp:SessionParameter Name="Dictationid" SessionField="Dictationid"   
                Type="Int32" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
        SelectCommand="SELECT ICD9 + '-' + Description AS icdcode, ICD9, ID FROM ICD9CODES">  
         
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="commonicd9sql" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
          
          
        SelectCommand="SELECT  ICD9 + '-' + Description AS icdcode, ICD9, ID FROM ICD9CODES where common=1">  
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="BillinginfolookupSQL" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
          
          
          
          
        SelectCommand="SELECT BillingID, Dictationid, Code, Parentid, Text FROM Dictation_Billingcodes WHERE (Parentid IS NULL)"   
        DeleteCommand="DELETE FROM Dictation_Billingcodes WHERE (BillingID = @billingid) OR (Parentid = @billingid)">  
        <DeleteParameters> 
            <asp:SessionParameter Name="billingid" SessionField="BillingID" /> 
        </DeleteParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="commoncptcodessql" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
        SelectCommand="SELECT CPTCode + '-' + CPTName AS Name, CPTCode, ID, Common FROM CPTCODES WHERE (Common = 1)"   
        InsertCommand="INSERT INTO Dictation_Billingcodes(Text) VALUES (@ddl1)">  
        <InsertParameters> 
            <asp:ControlParameter ControlID="DropDownList2" Name="ddl1"   
                PropertyName="text" /> 
        </InsertParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="BillingdetaillookupSQL" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
          
          
          
          
        SelectCommand="SELECT BillingID, Dictationid, Code, Parentid, Text FROM Dictation_Billingcodes WHERE (Parentid = @BillingID)">  
        <SelectParameters> 
            <asp:SessionParameter Name="BillingID" SessionField="BillingID" /> 
        </SelectParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource ID="PatientLookupSQL" runat="server"   
        ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
          
        SelectCommand="SELECT PatientID, PatientLast + ' ' + PatientFirst + ', ' + ISNULL(PatientMiddle, '') + '- ' + PatientDOB AS Patient FROM Patientinfo WHERE (PatientStatus = 'Active')">  
    </asp:SqlDataSource> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"   
        height="75px" IsSticky="True" Transparency="100" width="75px">  
        <img alt="Loading..."   
            src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'   
            style="border:0px;" /> 
    </telerik:RadAjaxLoadingPanel> 
                                    <asp:SqlDataSource ID="FaciltyLookupSQL"   
        runat="server" ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"   
          
          
        SelectCommand="SELECT FacilityID, GroupID, FacilityLocation, FacilityName, FacilityType, Address, Address2, City, State, Phone, Fax, FaxRecords, Contact, ContactTitle, TigerID, AltID, MarketingID, Company, OnCallEmail, DeliveryMethod, DeliveryAttention, ChartNotesFax, Notes, Groups, DateEntered, PostalCode, Email FROM facility ">  
    </asp:SqlDataSource> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
              
            <telerik:AjaxSetting AjaxControlID="RadComboBox2">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox2" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadioButtonList1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadioButtonList1" /> 
                      
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Hay">  
     
    </telerik:RadSkinManager> 
     
    <div style="text-align: center">  
     
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"   
        GridLines="None" HorizontalAlign="Center" Width="85%"   
            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"   
            ShowGroupPanel="True" > 
<MasterTableView AutoGenerateColumns="False" CellSpacing="-1"   
            DataSourceID="SqlDataSource1" DataKeyNames="Dictationid"   
            > 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
    <Columns> 
        <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit">  
        </telerik:GridEditCommandColumn> 
        <telerik:GridBoundColumn DataField="Dictationid" DataType="System.Int32"   
            HeaderText="JobNumber" ReadOnly="True" SortExpression="Dictationid"   
            UniqueName="Dictationid">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Dictator" HeaderText="Clinician"   
            UniqueName="column1">  
        </telerik:GridBoundColumn> 
        <telerik:GridTemplateColumn   
            UniqueName="AudioLinkColumn" HeaderText="Audio">  
              
            
              
            <ItemTemplate> 
                <asp:Image ID="Image4" runat="server" Width="19" Height="19px"   
                    ImageUrl="~/Images/Speaker_Icon.png" /> 
            </ItemTemplate> 
              
            
              
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="Dictatorid" DataType="System.Int32"   
            HeaderText="Dictatorid" SortExpression="Dictatorid"   
            UniqueName="Dictatorid" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Jobstate" DataType="System.Int32"   
            HeaderText="Jobstate" SortExpression="Jobstate" UniqueName="Jobstate"   
            Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="AssignedTranID" DataType="System.Int32"   
            HeaderText="AssignedTranID" SortExpression="AssignedTranID"   
            UniqueName="AssignedTranID" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="PriorityLevel" DataType="System.Byte"   
            HeaderText="PriorityLevel" SortExpression="PriorityLevel"   
            UniqueName="PriorityLevel" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Worktype" DataType="System.Byte"   
            HeaderText="Worktype" SortExpression="Worktype" UniqueName="Worktype"   
            Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Datedictated" DataType="System.DateTime"   
            HeaderText="Datedictated" SortExpression="Datedictated"   
            UniqueName="Datedictated">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DateUploaded" DataType="System.DateTime"   
            HeaderText="DateUploaded" SortExpression="DateUploaded"   
            UniqueName="DateUploaded" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="GroupID" UniqueName="column">  
        </telerik:GridBoundColumn> 
    </Columns> 
    <EditFormSettings EditFormType="Template">  
<EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
        <FormTemplate> 
              
            <div style="background-image: url('Images/bg-fade.gif')">  
                <table> 
                    <tr> 
                        <td rowspan="2" class="style2">  
                            <telerik:RadEditor ID="Radeditor1" Runat="server"   
                                Content='<%# Bind("Document") %>' EditModes="Design" Height="600px"   
                                Width="98%">  
                                <templatemanager searchpatterns="*.html,*.rtf" uploadpaths="~/Templates"   
                                    viewpaths="~/Templates" /> 
                                <content> 
                                </content> 
                                <tools> 
                                    <telerik:EditorToolGroup> 
                                        <telerik:EditorTool Name="InsertDate" /> 
                                        <telerik:EditorTool Name="Print" /> 
                                        <telerik:EditorTool Name="JustifyLeft" /> 
                                        <telerik:EditorTool Name="JustifyCenter" /> 
                                        <telerik:EditorTool Name="JustifyRight" /> 
                                        <telerik:EditorTool Name="TemplateManager" ShowText="True" Text="Templates" /> 
                                        <telerik:EditorTool Name="ToggleScreenMode" /> 
                                    </telerik:EditorToolGroup> 
                                </tools> 
                            </telerik:RadEditor> 
                        </td> 
                        <td style="vertical-align: top; background-color: #FFFFCC; background-image: url('Images/bg-fade.gif');">  
                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"   
                                RepeatDirection="Horizontal">  
                                <asp:ListItem Selected="True" Value="1">Common Records</asp:ListItem> 
                                <asp:ListItem Value="2">All Records</asp:ListItem> 
                            </asp:RadioButtonList> 
 
                            <br /> 
                            <div style="text-align: left">  
                                <img alt="" src="Images/Patientlbl.png" style="width: 100px; height: 22px" /><br /> 
                            </div> 
                            <div style="text-align: right; vertical-align: top; height: 232px; background-color: #FFFFCC; background-image: url('Images/bg-fade.gif');">  
                                <div style="text-align: left">  
                                    <asp:TextBox ID="TextBox1" runat="server" Width="300px"></asp:TextBox> 
                                    <br /> 
                                    <b> 
                                    <br /> 
                                    <div> 
                                        <img alt="" src="Images/Facilitylbl.png" style="width: 100px; height: 22px" /></div>  
                                    </b></div>  
                                <telerik:RadComboBox ID="RadComboBox4" Runat="server" AllowCustomText="True"   
                                    DataSourceID="FaciltyLookupSQL" DataTextField="FacilityName"   
                                    DataValueField="FacilityID" DropDownWidth="300px" EnableLoadOnDemand="True"   
                                    Filter="Contains" onselectedindexchanged="RadComboBox2_SelectedIndexChanged"   
                                    Width="300px">  
                                </telerik:RadComboBox> 
                                
                                <div style="text-align: left">  
                                    <br /> 
                                    <img alt="" src="Images/DOSlbl.png" style="width: 120px; height: 22px" /></div>  
                                <telerik:RadDatePicker ID="DOS" Runat="server" Width="300px">  
                                    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"   
                                        ViewSelectorText="x">  
                                    </Calendar> 
                                    <DatePopupButton HoverImageUrl="" ImageUrl="" /> 
                                </telerik:RadDatePicker> 
                                <br /> 
                                  
                                <div style="text-align: left">  
                                    <asp:Image ID="Image3" runat="server" ImageUrl="~/Images/Billincodestxt.png"   
                                        style="text-align: left" /> 
                                </div> 
                                  
                                 
                                <div style="text-align: left">  
                                    <telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True"   
                                        AllowAutomaticInserts="True" AllowAutomaticUpdates="True"   
                                        AutoGenerateColumns="False" DataSourceID="BillinginfolookupSQL"   
                                        GridLines="None" HorizontalAlign="Center" Skin="Sunset" style="margin-top: 0px"   
                                        Width="85%">  
                                        <MasterTableView CellSpacing="-1" CommandItemDisplay="Top"   
                                            DataKeyNames="BillingID,Dictationid,Parentid"   
                                            DataSourceID="BillinginfolookupSQL">  
                                            <RowIndicatorColumn> 
                                                <HeaderStyle Width="20px" /> 
                                            </RowIndicatorColumn> 
                                            <CommandItemSettings AddNewRecordText="Add CPT" /> 
                                            <Columns> 
                                                <telerik:GridEditCommandColumn ButtonType="ImageButton" headertext="Edit">  
                                                </telerik:GridEditCommandColumn> 
                                                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"   
                                                    ConfirmText="This CPT code and all associated ICD9 codes will be deleted!"   
                                                    ConfirmTitle="Warning!" headertext="Delete" Text="Delete" UniqueName="column3">  
                                                </telerik:GridButtonColumn> 
                                                <telerik:GridBoundColumn DataField="Text" HeaderText="CPT Code"   
                                                    UniqueName="column1">  
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn DataField="BillingID" HeaderText="ID" readonly="true"   
                                                    UniqueName="column2" Visible="False">  
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn DataField="dictationid" UniqueName="column"   
                                                    Visible="False">  
                                                </telerik:GridBoundColumn> 
                                            </Columns> 
                                            <EditFormSettings EditFormType="Template">  
                                                <EditColumn UniqueName="EditCommandColumn1">  
                                                </EditColumn> 
                                                <FormTemplate> 
                                                    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"   
                                                        DataSourceID="commoncptcodessql" DataTextField="Name" DataValueField="CPTCode"   
                                                        Width="400px">  
                                                    </asp:DropDownList> 
                                                    <asp:Button ID="Button4" runat="server" CommandName="Cancel" Text="Cancel" /> 
                                                    <asp:Button ID="Button5" runat="server" CommandName="Insert" Text="Insert" /> 
                                                    <asp:Button ID="btnUpdate" runat="server"   
                                                        CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'   
                                                        onclick="btnUpdate_Click"   
                                                        Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' /> 
                                                </FormTemplate> 
                                            </EditFormSettings> 
                                        </MasterTableView> 
                                        <ClientSettings> 
                                            <Selecting AllowRowSelect="True" /> 
                                        </ClientSettings> 
                                    </telerik:RadGrid> 
                                </div> 
                                <br /> 
                                <br /> 
                                <div style="padding: 0px; text-align: left; background-color: #FFFFCC; background-image: url('Images/bg-fade.gif');">  
                                    <hr /> 
                                    <br /> 
                                    <br /> 
                                </div> 
                                 
                            </div> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td style="vertical-align: top">  
                            &nbsp;</td> 
                    </tr> 
                </table> 
                <div style="text-align: left">  
                    <asp:Button ID="Button1" runat="server" CommandName="update"   
                        Text="Save Document" /> 
                    <asp:Button ID="Button2" runat="server" CommandName="cancel" Text="Cancel" /> 
                    <br /> 
                    <br /> 
                    <asp:Button ID="Button3" runat="server" CommandName="update"   
                        Text="Finalize Document" Width="196px" /> 
                </div> 
            </div> 
            <br /> 
        </FormTemplate> 
    </EditFormSettings> 
</MasterTableView> 
        <HeaderStyle HorizontalAlign="Center" /> 
        <ClientSettings AllowDragToGroup="True">  
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
 
      
 
    </div> 
 
      
 
 
      
 
    </form> 
    </body> 
</html> 
 
0
Robert
Top achievements
Rank 1
answered on 07 Dec 2009, 03:55 PM
This is driving me crazy, I can't seem to get the edited rows datakeyname to use for my queries inside my edit template I have tried using the Session("Dictationid") but I never get the value from Radgrid when I go into edit mode.

My SQL looks like this to populate a radgrid inside my edit template

<

 

asp:SqlDataSource ID="BillinginfolookupSQL" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:TESTDEVConnection %>"

 

 

 

 

 

 

 

 

SelectCommand="SELECT BillingID, Dictationid, Code, Parentid, Text FROM Dictation_Billingcodes WHERE (Parentid IS NULL) and dictationid=@Dictationid"

 

 

 

DeleteCommand="DELETE FROM Dictation_Billingcodes WHERE (BillingID = @billingid) OR (Parentid = @billingid)">

 

 


<
SelectParameters>

 

 

<asp:SessionParameter DefaultValue="" Name="Dictationid"

 

 

SessionField="Dictationid" />

 

 

</SelectParameters>

 

 


<
DeleteParameters>

 

 

<asp:SessionParameter Name="billingid" SessionField="BillingID" />

 

 

</DeleteParameters>

 

 

</asp:SqlDataSource>

Here is the grid code

 

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"   
        GridLines="None" HorizontalAlign="Center" Width="85%"   
            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"   
            ShowGroupPanel="True" > 
<MasterTableView AutoGenerateColumns="False" CellSpacing="-1"   
            DataSourceID="SqlDataSource1" DataKeyNames="Dictationid"   
            > 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
    <Columns> 
        <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Edit">  
        </telerik:GridEditCommandColumn> 
        <telerik:GridBoundColumn DataField="Dictationid" DataType="System.Int32"   
            HeaderText="Dictationid" ReadOnly="True" SortExpression="Dictationid"   
            UniqueName="Dictationid">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Dictator" HeaderText="Clinician"   
            UniqueName="column1">  
        </telerik:GridBoundColumn> 
        <telerik:GridTemplateColumn   
            UniqueName="AudioLinkColumn" HeaderText="Audio">  
              
            
              
            <ItemTemplate> 
                <asp:Image ID="Image4" runat="server" Width="19" Height="19px"   
                    ImageUrl="~/Images/Speaker_Icon.png" /> 
            </ItemTemplate> 
              
            
              
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="Dictatorid" DataType="System.Int32"   
            HeaderText="Dictatorid" SortExpression="Dictatorid"   
            UniqueName="Dictatorid" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Jobstate" DataType="System.Int32"   
            HeaderText="Jobstate" SortExpression="Jobstate" UniqueName="Jobstate"   
            Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="AssignedTranID" DataType="System.Int32"   
            HeaderText="AssignedTranID" SortExpression="AssignedTranID"   
            UniqueName="AssignedTranID" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="PriorityLevel" DataType="System.Byte"   
            HeaderText="PriorityLevel" SortExpression="PriorityLevel"   
            UniqueName="PriorityLevel" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Worktype" DataType="System.Byte"   
            HeaderText="Worktype" SortExpression="Worktype" UniqueName="Worktype"   
            Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Datedictated" DataType="System.DateTime"   
            HeaderText="Datedictated" SortExpression="Datedictated"   
            UniqueName="Datedictated">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DateUploaded" DataType="System.DateTime"   
            HeaderText="DateUploaded" SortExpression="DateUploaded"   
            UniqueName="DateUploaded" Visible="False">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Groupid" UniqueName="column"   
            HeaderText="Groupid">  
        </telerik:GridBoundColumn> 
    </Columns> 
    <EditFormSettings EditFormType="Template">  
<EditColumn UniqueName="EditCommandColumn1"></EditColumn> 
        <FormTemplate> 
              
            <div style="background-image: url('Images/bg-fade.gif')">  
                <table> 
                    <tr> 
                        <td rowspan="2" class="style2">  
                            <telerik:RadEditor ID="Radeditor1" Runat="server"   
                                Content='<%# Bind("Document") %>' EditModes="Design" Height="600px"   
                                Width="98%">  
                                <templatemanager searchpatterns="*.html,*.rtf" uploadpaths="~/Templates"   
                                    viewpaths="~/Templates" /> 
                                <content> 
                                </content> 
                                <tools> 
                                    <telerik:EditorToolGroup> 
                                        <telerik:EditorTool Name="InsertDate" /> 
                                        <telerik:EditorTool Name="Print" /> 
                                        <telerik:EditorTool Name="JustifyLeft" /> 
                                        <telerik:EditorTool Name="JustifyCenter" /> 
                                        <telerik:EditorTool Name="JustifyRight" /> 
                                        <telerik:EditorTool Name="TemplateManager" ShowText="True" Text="Templates" /> 
                                        <telerik:EditorTool Name="ToggleScreenMode" /> 
                                    </telerik:EditorToolGroup> 
                                </tools> 
                            </telerik:RadEditor> 
                        </td> 
                        <td style="vertical-align: top; background-color: #FFFFCC; background-image: url('Images/bg-fade.gif');">  
                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"   
                                RepeatDirection="Horizontal">  
                                <asp:ListItem Selected="True" Value="1">Common Records</asp:ListItem> 
                                <asp:ListItem Value="2">All Records</asp:ListItem> 
                            </asp:RadioButtonList> 
 
                            <br /> 
                            <div style="text-align: left">  
                                <img alt="" src="Images/Patientlbl.png" style="width: 100px; height: 22px" /><br /> 
                            </div> 
                            <div style="text-align: right; vertical-align: top; height: 232px; background-color: #FFFFCC; background-image: url('Images/bg-fade.gif');">  
                                <div style="text-align: left">  
                                    <telerik:RadComboBox ID="RadComboBox5" Runat="server" AllowCustomText="True"   
                                        DataSourceID="PatientLookupSQL" DataTextField="Patient"   
                                        DataValueField="PatientID" EnableLoadOnDemand="True" Filter="Contains"   
                                        Width="300px">  
                                    </telerik:RadComboBox> 
                                    <b> 
                                    <br /> 
                                    <div> 
                                        <img alt="" src="Images/Facilitylbl.png" style="width: 100px; height: 22px" /></div>  
                                    </b></div>  
                                
                                <div style="text-align: left">  
                                    <telerik:RadComboBox ID="RadComboBox4" Runat="server" AllowCustomText="True"   
                                        DataSourceID="FaciltyLookupSQL" DataTextField="FacilityName"   
                                        DataValueField="FacilityID" DropDownWidth="300px" EnableLoadOnDemand="True"   
                                        Filter="Contains" onselectedindexchanged="RadComboBox2_SelectedIndexChanged"   
                                        Width="300px">  
                                    </telerik:RadComboBox> 
                                    <br /> 
                                    <img alt="" src="Images/DOSlbl.png" style="width: 120px; height: 22px" /></div>  
                                <telerik:RadDatePicker ID="DOS" Runat="server" Width="300px">  
                                    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"   
                                        ViewSelectorText="x">  
                                    </Calendar> 
                                    <DatePopupButton HoverImageUrl="" ImageUrl="" /> 
                                </telerik:RadDatePicker> 
                                <br /> 
                                  
                                <div style="text-align: left">  
                                    <asp:Image ID="Image3" runat="server" ImageUrl="~/Images/Billincodestxt.png"   
                                        style="text-align: left" /> 
                                </div> 
                                  
                                 
                                <div style="text-align: left">  
                                    <telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True"   
                                        AllowAutomaticInserts="True" AllowAutomaticUpdates="True"   
                                        AutoGenerateColumns="False" DataSourceID="BillinginfolookupSQL"   
                                        GridLines="None" HorizontalAlign="Center" Skin="Sunset" style="margin-top: 0px"   
                                        Width="85%">  
                                        <MasterTableView CellSpacing="-1" CommandItemDisplay="Top"   
                                            DataKeyNames="BillingID,Dictationid,Parentid"   
                                            DataSourceID="BillinginfolookupSQL">  
                                            <RowIndicatorColumn> 
                                                <HeaderStyle Width="20px" /> 
                                            </RowIndicatorColumn> 
                                            <CommandItemSettings AddNewRecordText="Add CPT" /> 
                                            <Columns> 
                                                <telerik:GridEditCommandColumn ButtonType="ImageButton" headertext="Edit">  
                                                </telerik:GridEditCommandColumn> 
                                                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"   
                                                    ConfirmText="This CPT code and all associated ICD9 codes will be deleted!"   
                                                    ConfirmTitle="Warning!" headertext="Delete" Text="Delete" UniqueName="column3">  
                                                </telerik:GridButtonColumn> 
                                                <telerik:GridBoundColumn DataField="Text" HeaderText="CPT Code"   
                                                    UniqueName="column1">  
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn DataField="BillingID" HeaderText="ID" readonly="true"   
                                                    UniqueName="column2" Visible="False">  
                                                </telerik:GridBoundColumn> 
                                                <telerik:GridBoundColumn DataField="dictationid" UniqueName="column"   
                                                    Visible="False">  
                                                </telerik:GridBoundColumn> 
                                            </Columns> 
                                            <EditFormSettings EditFormType="Template">  
                                                <EditColumn UniqueName="EditCommandColumn1">  
                                                </EditColumn> 
                                                <FormTemplate> 
                                                    <asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True"   
                                                        DataSourceID="commoncptcodessql" DataTextField="Name" DataValueField="CPTCode"   
                                                        Width="400px">  
                                                    </asp:DropDownList> 
                                                    <asp:Button ID="Button4" runat="server" CommandName="Cancel" Text="Cancel" /> 
                                                    <asp:Button ID="Button5" runat="server" CommandName="Insert" Text="Insert" /> 
                                                    <asp:Button ID="btnUpdate" runat="server"   
                                                        CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'   
                                                        onclick="btnUpdate_Click"   
                                                        Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' /> 
                                                </FormTemplate> 
                                            </EditFormSettings> 
                                        </MasterTableView> 
                                        <ClientSettings> 
                                            <Selecting AllowRowSelect="True" /> 
                                        </ClientSettings> 
                                    </telerik:RadGrid> 
                                </div> 
                                <br /> 
                                <br /> 
                                <div style="padding: 0px; text-align: left; background-color: #FFFFCC; background-image: url('Images/bg-fade.gif');">  
                                    <hr /> 
                                    <br /> 
                                    <br /> 
                                </div> 
                                 
                            </div> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td style="vertical-align: top">  
                            &nbsp;</td> 
                    </tr> 
                </table> 
                <div style="text-align: left">  
                    <asp:Button ID="Button1" runat="server" CommandName="update"   
                        Text="Save Document" /> 
                    <asp:Button ID="Button2" runat="server" CommandName="cancel" Text="Cancel" /> 
                    <br /> 
                    <br /> 
                    <asp:Button ID="Button3" runat="server" CommandName="update"   
                        Text="Finalize Document" Width="196px" /> 
                </div> 
            </div> 
            <br /> 
        </FormTemplate> 
    </EditFormSettings> 
</MasterTableView> 
        <HeaderStyle HorizontalAlign="Center" /> 
        <ClientSettings AllowDragToGroup="True">  
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 




Can anyone tell me how to get this "Dictationid"  Value from Radgrid1 when I go into edit mode.
0
Radoslav
Telerik team
answered on 10 Dec 2009, 03:31 PM
Hello Robert,

I went through your code and I assume the problem is that the second datasource is outside the RadGrid1 control. Thus its select parameter could not be set properly.
I’m sending you a simple example, based on your code. In this example I moved the second datasource into RadGrid and add the following code in ItemComand event handler:

 

Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
Dim value As String = item("Dictationid").Text
Session("Dictationid") = value

 

This code fragment puts the value of Dictationid cell into the Session. When the second RadGrid is created the value will be in the Session and could be taken from there.

I hope this example helps.


Kind regards,
Radoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Robert
Top achievements
Rank 1
answered on 10 Dec 2009, 07:12 PM
Thanks that works great it feeds my Query correctly however when I click on any of the buttons I am getting a Null Reference Exception.


Protected

 

Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand

 

 

Dim item As GridDataItem = TryCast(e.Item, GridDataItem)

 

 

Dim value As String = item("Dictationid").Text----this is where I get the error

 

Session(

"Dictationid") = value

 

 

End Sub

 

       

     

 

 

 

 

 

 

 

0
Accepted
Radoslav
Telerik team
answered on 11 Dec 2009, 12:28 PM
Hello Robert,

The e.Item argument of the ItemCommand event henalder can be of various types depending on the fired command. For example, when user clicks Edit button e.Item is of GridDataItem type, if user clicks on the filtering buttons e.Item is of GridFilterinItem type. In your case to avoid NullReference Exception you need to check if casted item is Nothing. So you can try modifying your previous code to:

Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
        Dim item As GridDataItem = TryCast(e.Item, GridDataItem)
        If Not item Is Nothing Then
            Dim value As String = item("Dictationid").Text
            Session("Dictationid") = value
        End If
    End Sub

 


Regards,
Radoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Robert
Top achievements
Rank 1
answered on 11 Dec 2009, 02:16 PM
Much thanks to you this will definitly solve a whole cache of issues.
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Rob T
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or