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

Customizing Advanced Form. Adding Custom Controls

1 Answer 53 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Ekjot
Top achievements
Rank 1
Ekjot asked on 14 Aug 2013, 07:58 PM
Hello


I used the tutorial to create my own custom template for the Advanced Form for inserting and updating appointments in the Scheduler. 

One of the resources I have are various a patient that a doctor can schedule an appointment for. This resource is really big so its inefficient putting it in a comboBox and scrolling. Instead I added a RadGrid with filtering so a person can search for a patient easier. I wanted to add code on the selectIndexchanged that would set the subject as the patient selected and also select the appropriate value in the ComboBox based on PatientID. The postback code however doesn't do anything and it just stays empty. Does anyone know how I can get that working or could make a suggestion on a more efficient way to handle this scenario?  

Thanks in advance!

Edit: forgot to post the code I did so far

AdvancedForm.ascx -->added this code in this form
<table>
    <tr>
        <td>Search Patient:
        </td>
    </tr>
    <tr>
        <td>
 
 
            <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                DataSourceID="SqlDataSourceAllPats" GridLines="None" AllowFilteringByColumn="True" AllowPaging="True"
                EnableLinqExpressions="False" Width="600px" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">
 
                <MasterTableView Width="600px" DataSourceID="SqlDataSourceAllPats" AutoGenerateColumns="False" DataKeyNames="Account_Number" ClientDataKeyNames="Account_Number">
 
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <Columns>
                        <telerik:GridButtonColumn HeaderText="" Text="Select" CommandName="Select" />
                        <telerik:GridBoundColumn FilterControlAltText="Filter Account_Number column" HeaderText="Acct No"
                            UniqueName="AcctNo" DataField="Account_Number" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"
                            ShowFilterIcon="false"
                            EmptyDataText="" Visible="true" ItemStyle-Width="60px" HeaderStyle-Width="60px">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter FirstName column" HeaderText="First Name"
                            UniqueName="FirstName" DataField="FirstName" EmptyDataText="" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"
                            ShowFilterIcon="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter LastName column" HeaderText="Last Name"
                            UniqueName="LastName" DataField="LastName" EmptyDataText="" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"
                            ShowFilterIcon="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter Birthdate column" HeaderText="Date of Birth"
                            UniqueName="Birthdate" DataField="Birthdate" EmptyDataText="" DataFormatString="{0:MM/dd/yyyy}">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter SSN column" HeaderText="SSN"
                            UniqueName="SSN" DataField="SSN" EmptyDataText="" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"
                            ShowFilterIcon="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter Address column" HeaderText="Address"
                            UniqueName="Address" DataField="Address" EmptyDataText="">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
 
                </MasterTableView>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
                <ClientSettings>
                    <Scrolling AllowScroll="true"></Scrolling>
                </ClientSettings>
            </telerik:RadGrid>
 
        </td>
    </tr>
</table>
<asp:SqlDataSource ID="SqlDataSourceAllPats" runat="server"
    ConnectionString="<%$ ConnectionStrings:kcMedic_Central_Connection %>"
    SelectCommand="sp_patientList" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:SessionParameter DefaultValue="C002" Name="SITE_ID_LNK" SessionField="SiteId" Type="String" />
    </SelectParameters>
</asp:SqlDataSource>


Code-behind:
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
    string KeyID = (RadGrid1.SelectedItems[0] as GridDataItem).GetDataKeyValue("Account_Number").ToString();
 
    string name = (RadGrid1.SelectedItems[0] as GridDataItem)["FirstName"].Text.Trim() + " " +
                  (RadGrid1.SelectedItems[0] as GridDataItem)["LastName"].Text.Trim();
 
    (ResPatient.FindControl("ResourceValue") as RadComboBox).SelectedValue = KeyID;
 
    Subject = name;
    this.SubjectText.Text = name;
    this.SubjectText.ReadOnly = true;
 
}

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 19 Aug 2013, 05:02 PM
Hello,

 
If you want to populate the Subject field of the Advanced Form you will have to override the following definition in the code behind according to your scenario:

[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
         public string Subject
         {
              get
              {
                   return SubjectText.Text;
              }
 
              set
              {
                   SubjectText.Text = value;
              }
         }

Hope this will be helpful.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Scheduler
Asked by
Ekjot
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or