Using TemplateThree or Four programmaticaly

Aug 20, 2007 at 6:33 PM
Is there an easy way to put information inside the patientbanner control as to getting some access to the templatethree and templatefour propierties, get info from a datasource?
Aug 23, 2007 at 5:07 PM

vgarcias wrote:
Is there an easy way to put information inside the patientbanner control as to getting some access to the templatethree and templatefour propierties, get info from a datasource?

Hi

If you take a look at http://www.mscui.com/Samples/PatientBanner/ExtendedPatientBanner.aspx there is an example of placing information into template three and four. The markup for this can be seen if you take a look at the ExtendedPatientBanner.aspx source file in the zip file contained within the MSCUICTP.msi file. I've shown a snippet of the markup below:

<NhsCui:PatientBanner ID="patientBanner1" PatientImage="~/Images/PatientSnaps/SChandraseknar.gif"
FamilyName="Chandrasekhar" GivenName="Subramanyan" Title="Mr" DateOfBirth="14-Jul-1945"
Identifier="434 382 8352" Gender="Male" HomePhoneNumber="(01632) 960564" WorkPhoneNumber="(01632) 960555"
MobilePhoneNumber="(07971) 184701" EmailLabelText="email:" EmailAddress="ChSubram@abc.xyz" Address1="56"
Address2="Mississippi Close" Town="Eastleigh" County="Hampshire" PostCode="SO50 7TH"
AccessKey="E" ZoneTwoTooltip="Click to expand" SubsectionThreeTitle="Other Information"
SubsectionFourTitle="Clinicians" runat="server">
<SubsectionThreeTemplate>
<table style="width: 200px">
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Known as:</th>
<td style="font-size: 9pt;">
Chad</td>
</tr>
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Ethnicity:</th>
<td style="font-size: 9pt;">
Asian, British</td>
</tr>
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Dispensing Patient:</th>
<td style="font-size: 9pt;">
Yes</td>
</tr>
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Patient Type:</th>
<td style="font-size: 9pt;">
Full NHS</td>
</tr>
</table>
</SubsectionThreeTemplate>
</NhsCui:PatientBanner>

Hope that helps.

Regards.
Tom.
Aug 27, 2007 at 7:17 PM
Yes, I noticed that example before making the question. Let me show you what ai want with code....

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim intIDPaciente As Integer = Request.QueryString("id")
Dim odsPacientes As Data.DataSet
Dim odsDireccion As Data.DataSet
Dim dsPacientes As New Pacientes
Dim dsDireccion As New Direcciones
Dim opcionGenero As String

odsPacientes = dsPacientes.obtenerPorIDPaciente(intIDPaciente)

'Llenar datos del paciente
opcionGenero = odsPacientes.Tables(0).Rows(0).Item("Genero").ToString
If Not IsDBNull(odsPacientes.Tables(0).Rows(0).Item("Foto")) Then
PatientBanner1.PatientImage = "/images/pacientes/" & odsPacientes.Tables(0).Rows(0).Item("Foto")
End If
PatientBanner1.GivenName = odsPacientes.Tables(0).Rows(0).Item("Nombre").ToString
PatientBanner1.FamilyName = odsPacientes.Tables(0).Rows(0).Item("ApellidoPaterno").ToString & " " & odsPacientes.Tables(0).Rows(0).Item("ApellidoMaterno").ToString
PatientBanner1.DateOfBirth = odsPacientes.Tables(0).Rows(0).Item("FechaNacimiento").ToString
.
.
.
PatientBanner1.Country = odsDireccion.Tables(0).Rows(0).Item("Pais").ToString
End Sub

The last code is working great... now I want to access the template three and four... the same way.... programmatically....

Some ideas?



TomBlackburn wrote:

vgarcias wrote:
Is there an easy way to put information inside the patientbanner control as to getting some access to the templatethree and templatefour propierties, get info from a datasource?

Hi

If you take a look at http://www.mscui.com/Samples/PatientBanner/ExtendedPatientBanner.aspx there is an example of placing information into template three and four. The markup for this can be seen if you take a look at the ExtendedPatientBanner.aspx source file in the zip file contained within the MSCUICTP.msi file. I've shown a snippet of the markup below:

<NhsCui:PatientBanner ID="patientBanner1" PatientImage="~/Images/PatientSnaps/SChandraseknar.gif"
FamilyName="Chandrasekhar" GivenName="Subramanyan" Title="Mr" DateOfBirth="14-Jul-1945"
Identifier="434 382 8352" Gender="Male" HomePhoneNumber="(01632) 960564" WorkPhoneNumber="(01632) 960555"
MobilePhoneNumber="(07971) 184701" EmailLabelText="email:" EmailAddress="ChSubram@abc.xyz" Address1="56"
Address2="Mississippi Close" Town="Eastleigh" County="Hampshire" PostCode="SO50 7TH"
AccessKey="E" ZoneTwoTooltip="Click to expand" SubsectionThreeTitle="Other Information"
SubsectionFourTitle="Clinicians" runat="server">
<SubsectionThreeTemplate>
<table style="width: 200px">
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Known as:</th>
<td style="font-size: 9pt;">
Chad</td>
</tr>
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Ethnicity:</th>
<td style="font-size: 9pt;">
Asian, British</td>
</tr>
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Dispensing Patient:</th>
<td style="font-size: 9pt;">
Yes</td>
</tr>
<tr>
<th class="nhscuipbzone2_label" style="text-align: right">
Patient Type:</th>
<td style="font-size: 9pt;">
Full NHS</td>
</tr>
</table>
</SubsectionThreeTemplate>
</NhsCui:PatientBanner>

Hope that helps.

Regards.
Tom.

Coordinator
Dec 19, 2007 at 2:37 PM
Apologies for the delay in responding to this.

Option 1:
 Create an ASCX file and assign that as SubsectionThree/SubsectionFour template.
 Initialize the data in the User Control load
this.patientBanner.SubsectionThreeTemplate = Page.LoadTemplate("SSThreeTemp.ascx")

Option 2:
 Create a class that implements ITemplate and assign that as SubsectionThree/SubsectionFour template.
public class SubsectionThreeTemp : ITemplate
{
private string messageText;
public string Message
{
get
{
return this.messageText;
}

set
{
this.messageText = value;
}
}

void ITemplate.InstantiateIn(Control container)
{
Label lblMessage = new Label();
lblMessage.Text = this.messageText;
container.Controls.Add(lblMessage);
}
}

And to assign the data, use the following snippet
SubsectionThreeTemp ssthreeTemplate = new SubsectionThreeTemp();
ssthreeTemplate.Message = "Subsection Three";
this.patientBanner.SubsectionThreeTemplate = ssthreeTemplate;
Dec 26, 2007 at 8:20 PM
Mike,

Thank you. But Richard Pullen sent me another simple solution,:

CType(PatientBanner1.FindControl("prueba"), Label).Text = "hola mundo"

<SubsectionThreeTemplate>
<asp:Label runat="server" ID="prueba"></asp:Label>
</SubsectionThreeTemplate>

Which in my case I use with some databinding;

CType... = odsPacientes.Tables(0).Rows(0).Item("Nombre").ToString

And it has been working for a few weeks....

Nevertheless I'll try yours.

Greetings
Dec 26, 2007 at 8:21 PM
Mike,

Thank you. But Richard Pullen sent me another simple solution,:

CType(PatientBanner1.FindControl("prueba"), Label).Text = "hola mundo"

SubsectionThreeTemplate
asp:Label runat="server" ID="prueba" /asp:Label
/SubsectionThreeTemplate

Which in my case I use with some databinding;

CType... = odsPacientes.Tables(0).Rows(0).Item("Nombre").ToString

And it has been working for a few weeks....

Nevertheless I'll try yours.

Greetings