By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,883 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,883 IT Pros & Developers. It's quick & easy.

HTMLGenericControls, ascx, and span

P: n/a
Sue
I have created a web user control containing a web calendar (among other
controls) that is shown/hidden when the user clicks an imagebutton. I've used
SPAN tags to show/hide the calendar. I need to use several instances of this
user control in my main web page. What I need how is way to give the SPAN tag
an unique identifier for each instance of the user control so I can use
client-side code to show/hide the right instance of the web calendar without
making a trip to the server and back. I'm not quite getting all the pieces in
place using the HTMLGenericControl to make this work. Any suggestions?

tia,
Sue
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi Sue,

How about embedding the calendar in a Panel control? That will wrap it in a
Div that you can use much like the Span.

You can calculate the ID fairly well this way. Some code below. Let us know
if this helps?

Ken
Microsoft MVP [ASP.NET]
usrcalendar.ascx

<asp:Panel id="Panel1" runat="server"><asp:Calendar id="Calendar1"
runat="server"></asp:Calendar></asp:Panel>

usecalendar.aspx

<form id="Form1" method="post" runat="server">
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
<P>
<uc1:usrcalendar id="Usrcalendar1" runat="server"></uc1:usrcalendar>
<uc1:usrcalendar id="Usrcalendar2" runat="server"></uc1:usrcalendar>
<uc1:usrcalendar id="Usrcalendar3" runat="server"></uc1:usrcalendar></P>
</form>

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", _
"document.all.Usrcalendar2_Panel1.style.visibility =" & _
"'hidden';return false;")
End Sub

"Sue" <Su*@ojd.state.or.us> wrote in message
news:56**********************************@microsof t.com...
I have created a web user control containing a web calendar (among other
controls) that is shown/hidden when the user clicks an imagebutton. I've
used
SPAN tags to show/hide the calendar. I need to use several instances of
this
user control in my main web page. What I need how is way to give the SPAN
tag
an unique identifier for each instance of the user control so I can use
client-side code to show/hide the right instance of the web calendar
without
making a trip to the server and back. I'm not quite getting all the pieces
in
place using the HTMLGenericControl to make this work. Any suggestions?

tia,
Sue

Nov 19 '05 #2

P: n/a
Sue
Ken, thank you - worked just fine. Never thought to use panels in lieu of
spans.

Thanks!
Sue

"Ken Cox [Microsoft MVP]" wrote:
Hi Sue,

How about embedding the calendar in a Panel control? That will wrap it in a
Div that you can use much like the Span.

You can calculate the ID fairly well this way. Some code below. Let us know
if this helps?

Ken
Microsoft MVP [ASP.NET]
usrcalendar.ascx

<asp:Panel id="Panel1" runat="server"><asp:Calendar id="Calendar1"
runat="server"></asp:Calendar></asp:Panel>

usecalendar.aspx

<form id="Form1" method="post" runat="server">
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
<P>
<uc1:usrcalendar id="Usrcalendar1" runat="server"></uc1:usrcalendar>
<uc1:usrcalendar id="Usrcalendar2" runat="server"></uc1:usrcalendar>
<uc1:usrcalendar id="Usrcalendar3" runat="server"></uc1:usrcalendar></P>
</form>

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", _
"document.all.Usrcalendar2_Panel1.style.visibility =" & _
"'hidden';return false;")
End Sub

"Sue" <Su*@ojd.state.or.us> wrote in message
news:56**********************************@microsof t.com...
I have created a web user control containing a web calendar (among other
controls) that is shown/hidden when the user clicks an imagebutton. I've
used
SPAN tags to show/hide the calendar. I need to use several instances of
this
user control in my main web page. What I need how is way to give the SPAN
tag
an unique identifier for each instance of the user control so I can use
client-side code to show/hide the right instance of the web calendar
without
making a trip to the server and back. I'm not quite getting all the pieces
in
place using the HTMLGenericControl to make this work. Any suggestions?

tia,
Sue


Nov 19 '05 #3

P: n/a
Glad to help!

Ken

"Sue" <Su*@ojd.state.or.us> wrote in message
news:BA**********************************@microsof t.com...
Ken, thank you - worked just fine. Never thought to use panels in lieu of
spans.

Thanks!
Sue

"Ken Cox [Microsoft MVP]" wrote:
Hi Sue,

How about embedding the calendar in a Panel control? That will wrap it in
a
Div that you can use much like the Span.

You can calculate the ID fairly well this way. Some code below. Let us
know
if this helps?

Ken
Microsoft MVP [ASP.NET]
usrcalendar.ascx

<asp:Panel id="Panel1" runat="server"><asp:Calendar id="Calendar1"
runat="server"></asp:Calendar></asp:Panel>

usecalendar.aspx

<form id="Form1" method="post" runat="server">
<P>
<asp:Button id="Button1" runat="server"
Text="Button"></asp:Button></P>
<P>
<uc1:usrcalendar id="Usrcalendar1" runat="server"></uc1:usrcalendar>
<uc1:usrcalendar id="Usrcalendar2" runat="server"></uc1:usrcalendar>
<uc1:usrcalendar id="Usrcalendar3"
runat="server"></uc1:usrcalendar></P>
</form>

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Attributes.Add("onclick", _
"document.all.Usrcalendar2_Panel1.style.visibility =" & _
"'hidden';return false;")
End Sub

"Sue" <Su*@ojd.state.or.us> wrote in message
news:56**********************************@microsof t.com...
>I have created a web user control containing a web calendar (among other
> controls) that is shown/hidden when the user clicks an imagebutton.
> I've
> used
> SPAN tags to show/hide the calendar. I need to use several instances of
> this
> user control in my main web page. What I need how is way to give the
> SPAN
> tag
> an unique identifier for each instance of the user control so I can use
> client-side code to show/hide the right instance of the web calendar
> without
> making a trip to the server and back. I'm not quite getting all the
> pieces
> in
> place using the HTMLGenericControl to make this work. Any suggestions?
>
> tia,
> Sue


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.