• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Want to get organized in 2022? Let Dokkio put your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in order. Try Dokkio (from the makers of PBworks) for free. Available on the web, Mac, and Windows.


Lecture - AJAX - TextBoxWatermarkExtender - ModelPopup

This version was saved 9 years, 7 months ago View current version     Page history
Saved by Dr. Ron Eaglin
on June 19, 2012 at 8:14:57 am


TextBoxWatermarkExtender - ModelPopup AJAX Controls






Case Study - Trauma Flow Database




I show how to use the TextBoxWatermarkExtender to put a watermark in text boxes. I also show a simple use of the AJAX ModalPopupExtender to display help information.






Reference Materials
























<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucMechanismOfInjury.ascx.cs" Inherits="TraumaFlow.UserControls.ucMechanismOfInjury" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
        <asp:CheckBoxList ID="cblMain" runat="server" 
            onselectedindexchanged="cblMain_SelectedIndexChanged" AutoPostBack="True">
        <asp:ListItem >GSW</asp:ListItem>
        <td >            
            <asp:CheckBoxList ID="cblAuto" runat="server" Visible="false">
            <asp:RadioButtonList ID="rblHelmet" runat="server" Visible="false">
            <asp:ListItem>No Helmet</asp:ListItem>
            <asp:CheckBox ID="cbSeatbelt" runat="server" Visible="false" Text="Seatbelt?" /><br />
            <asp:CheckBox ID="cbAirbag" runat="server" Visible="false" Text= "Airbag?" /><br />
        <asp:TextBox ID="tbSpeed" runat="server" Visible="false"></asp:TextBox>
           <cc1:TextBoxWatermarkExtender ID="tbweSpeed" runat="server" WatermarkText="Speed" TargetControlID="tbSpeed">
           </cc1:TextBoxWatermarkExtender><br />          
        <asp:TextBox ID="tbFall" runat="server" Visible="false"></asp:TextBox>
            <cc1:TextBoxWatermarkExtender ID="tbweFallInfo" runat="server" WatermarkText="Fall Information" TargetControlID="tbFall">
            </cc1:TextBoxWatermarkExtender><br />
        <asp:TextBox ID="tbCaliber" runat="server" Visible="false"></asp:TextBox>
            <cc1:TextBoxWatermarkExtender ID="tbweCaliber" runat="server" WatermarkText="Caliber" TargetControlID="tbCaliber">
            </cc1:TextBoxWatermarkExtender><br />
        <asp:TextBox ID="tbOther" runat="server" Visible="false"></asp:TextBox>
            <cc1:TextBoxWatermarkExtender ID="tbweOther" runat="server" WatermarkText="Other Injury" TargetControlID="tbOther">
        </table><br />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" 
    onclick="btnSubmit_Click" />
<asp:Button ID="btnHelp" runat="server" Text="Help" />
<cc1:ModalPopupExtender ID="mpeHelp"  runat="server" TargetControlID="btnHelp"
    CancelControlID="btnCancel" OkControlID="btnOkay" 
    PopupControlID="Panel1" BackgroundCssClass="helpBackground" X="400" Y="100">
<asp:panel id="Panel1" style="display: none" runat="server">    
                <div class="PopupHeader" id="PopupHeader">Header</div>
                <div class="PopupBody">
                    <p>This is a simple modal dialog - You can insert text here</p>
                <div class="Controls">
                    <input id="btnOkay" type="button" value="Done" />
                    <input id="btnCancel" type="button" value="Cancel" />

















using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TraumaFlow.UserControls
    public partial class ucMechanismOfInjury : System.Web.UI.UserControl
        protected void Page_Load(object sender, EventArgs e)
        protected void cblMain_SelectedIndexChanged(object sender, EventArgs e)
            // 0 - AUTO   1 - MC   2 - FALL   3 - GSW
            // 4 - STAB   5 - BICYCLE 6 - CRUSH   7 - BURN   8 - OTHER
            if (cblMain.Items[0].Selected) // Auto
                cblAuto.Visible = true;
                tbSpeed.Visible = true;
                cbSeatbelt.Visible = true;
                cbAirbag.Visible = true;
                cblAuto.Visible = false;
                tbSpeed.Visible = false;
                cbSeatbelt.Visible = false;
                cbAirbag.Visible = false;
            if (cblMain.Items[1].Selected) // Motorcycle
                rblHelmet.Visible = true;
                tbSpeed.Visible = true;
                rblHelmet.Visible = false;
                tbSpeed.Visible = cblMain.Items[0].Selected;
            if (cblMain.Items[2].Selected) // Fall
                tbFall.Visible = true;
                tbFall.Visible = false;
            if (cblMain.Items[3].Selected)
                tbCaliber.Visible = true;
                tbCaliber.Visible = false;
            if (cblMain.Items[8].Selected) // Other
                tbOther.Visible = true;
                tbOther.Visible = false;
            string s = String.Empty;
            for (int j = 0; j < cblMain.Items.Count; j++)
                if (cblMain.Items[j].Selected) s += cblMain.Items[j].Value + ";";
        protected void btnSubmit_Click(object sender, EventArgs e)


Additional Information


Textbox Watermark Extender



Modal Popup Dialog






COP 4834 Lectures Page

Comments (0)

You don't have permission to comment on this page.