Hello, I have the following requirements for enhancing a radgrid on a page on our website:
1. When the insert form is opened, the end user should only see the Date of Service and Status fields enabled.
2. Upon selecting a status, the other elements in the form should be updated based on the selected status
Here is how we have our radgrid set up in the aspx page:
<telerik:RadGrid ID="RadGrid2" ShowStatusBar="True" runat="server" AllowPaging="True" PageSize="5" DataSourceID="SqlDataSource2" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" ShowFooter="True" Skin="Silk" ShowHeader="False" AllowSorting="True"> <MasterTableView Width="100%" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" CommandItemDisplay="Top" ShowFooter="False" EditMode="PopUp" DataKeyNames="VisitsID" ShowHeader="True" InsertItemPageIndexAction="ShowItemOnCurrentPage"> <EditFormSettings PopUpSettings-Height="400px" PopUpSettings-Width="810px"> <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn column"/> <PopUpSettings Modal="True" Height="400px" Width="810px" ScrollBars="Vertical"/> </EditFormSettings> <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Add new visit"/> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"/> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"/> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> <ItemStyle CssClass="MyImageButton" /> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="ClaimsID" DataType="System.Int32" FilterControlAltText="Filter ClaimsID column" HeaderText="ClaimsID" ReadOnly="True" SortExpression="ClaimsID" UniqueName="ClaimsID" Visible="False"/> <telerik:GridBoundColumn DataField="FirstName" FilterControlAltText="Filter FirstName column" HeaderText="Name" SortExpression="FirstName" UniqueName="FirstName" ReadOnly="True"/> <telerik:GridDateTimeColumn DataField="DOS" FilterControlAltText="Filter DOS column" HeaderText="DOS" SortExpression="DOS" DataFormatString = "{0:d}" UniqueName="DOS" DataType="System.DateTime"> <ColumnValidationSettings EnableRequiredFieldValidation="True"> <RequiredFieldValidator Display="Dynamic" ErrorMessage="DOS is Required!" Font-Bold="True" ForeColor="Red" SetFocusOnError="True"/> </ColumnValidationSettings> </telerik:GridDateTimeColumn> <telerik:GridDropDownColumn DataSourceID="SqlDataSource4" ListTextField="Units" ListValueField="Units" UniqueName="Units" SortExpression="Units" HeaderText="Units" DataField="Units" DropDownControlType="RadComboBox" FooterText="RadComboBox column footer" AllowAutomaticLoadOnDemand="false" AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10"/> <telerik:GridDropDownColumn DataSourceID="SqlDataSource6" ListTextField="DDDDescription" ListValueField="DDDCode" FilterControlAltText="Filter DDDCode column" HeaderText="Code" DataField="DDDCode" SortExpression="DDDCode" UniqueName="DDDCode" DropDownControlType="RadComboBox" FooterText="RadComboBox column footer" AllowAutomaticLoadOnDemand="false" AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10"/> <telerik:GridDropDownColumn DataSourceID="SqlDataSource7" ListTextField="VisitStatus" ListValueField="VisitStatus" FilterControlAltText="Filter Status column" HeaderText="Status" DataField="VisitStatus" SortExpression="VisitStatus" UniqueName="VisitStatus" DropDownControlType="RadComboBox" FooterText="RadComboBox column footer" AllowAutomaticLoadOnDemand="false" AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10"/> <telerik:GridBoundColumn DataField="TherapistID" FilterControlAltText="Filter TherapistID column" HeaderText="TherapistID" SortExpression="TherapistID" UniqueName="TherapistID" Visible="False"/> <telerik:GridBoundColumn DataField="PatientID" FilterControlAltText="Filter PatientID column" HeaderText="PatientID" SortExpression="PatientID" UniqueName="PatientID" DataType="System.Int32" Visible="False"/> <telerik:GridTemplateColumn HeaderText="Subjective" UniqueName="Subjective"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Subjective") %>' TextMode="MultiLine" Height="70px" Width="700px" Wrap="True"/> <asp:CustomValidator id="custV" runat="server" ControlToValidate = "TextBox1" ErrorMessage = "Minimum of 25 characters required" ClientValidationFunction="MinLength"/> <asp:RequiredFieldValidator id="RequiredFieldValidator1" ControlToValidate="TextBox1" Text="Subjective Is Required" runat="server"/> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("Subjective") %>'/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Objective" UniqueName="Objective" > <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Objective") %>' TextMode="MultiLine" Height="70px" Width="700px"/> <asp:CustomValidator id="custV2" runat="server" ControlToValidate = "TextBox2" ErrorMessage = "Minimum of 25 characters required" ClientValidationFunction="MinLength"/> <asp:RequiredFieldValidator id="RequiredFieldValidator2" ControlToValidate="TextBox2" Text="Objective Is Required" runat="server"/> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Eval("Objective") %>'/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Assessment" UniqueName="Assessment" > <EditItemTemplate> <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Assessment") %>' TextMode="MultiLine" Height="70px" Width="700px"/> <asp:CustomValidator id="custV3" runat="server" ControlToValidate = "TextBox3" ErrorMessage = "Minimum of 25 characters required" ClientValidationFunction="MinLength"/> <asp:RequiredFieldValidator id="RequiredFieldValidator3" ControlToValidate="TextBox3" Text="Assessment Is Required" runat="server"/> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label3" runat="server" Text='<%# Eval("Assessment") %>'/> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn HeaderText="Plan" UniqueName="Plann" > <EditItemTemplate> <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Plann") %>' TextMode="MultiLine" Height="70px" Width="700px"/> <asp:CustomValidator id="custV4" runat="server" ControlToValidate = "TextBox4" ErrorMessage = "Minimum of 25 characters required" ClientValidationFunction="MinLength"/> <asp:RequiredFieldValidator id="RequiredFieldValidator4" ControlToValidate="TextBox4" Text="Plan Is Required" runat="server"/> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label4" runat="server" Text='<%# Eval("Plann") %>'></asp:Label> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="UserName" FilterControlAltText="Filter UserName column" HeaderText="UserName" SortExpression="UserName" UniqueName="UserName" Visible="False" ReadOnly="True"/> <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this visit?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> </Columns> <EditFormSettings UserControlName="Home Health Billing"> <EditColumn FilterControlAltText="Filter EditCommandColumn column"/> <PopUpSettings Modal="True" /> </EditFormSettings> <PagerStyle AlwaysVisible="True" /> </MasterTableView> <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true"> <ClientEvents OnPopUpShowing="PopUpShowing" /> <Selecting AllowRowSelect="true" /> </ClientSettings> <PagerStyle Mode="Advanced" AlwaysVisible="True" /> <FilterMenu EnableImageSprites="False"/> </telerik:RadGrid>
I have already attempting using OnItemCommand and checking for InitInsert but during this time the ItemCommandArgs.Item attribute is not a GridDataItem of any kind, it always spits out a cast error when trying to cast it to get at the columns to modify them as per our requirements.
The crux of it is that some way, either once the initinsert command has been issues or when the popup modal open command is issues we need to get into the popup window and make changes and then we also need to make changes when the status is changed.
How would we access the open popup modal from an OnSelectedIndexChanged sub? My first guess would be getting the tableview through the owner of the sender parameter but that will only be applicable if the controls in the popup can remain grid elements.
Is something that can be done with a RadGrid or will we need to re-engineer the page to implement this?
Thanks.
