Is it possible to turn this image on and off using JaveScript

C

Cal Who

The master has a routine that I call in the code behind to turn some things
on or off.

smothing.Visible = Not Me.Master.HideSomeParts()

One of the content pages reads data from an xml file into a asp:Literal



<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Organization/AccordionData.xml"
XPath="/DefaultDataItems/DataItem"></asp:XmlDataSource>

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

<ContentTemplate>

<asp:Literal Mode="PassThrough" runat="server" Text='<%#XPath("Contents")%>'
/>

</ContentTemplate>

</ajaxToolkit:Accordion>





The data is html markup and is displayed on the browser.

In one case the data causes an image to be displayed

<Contents>

<![CDATA[

<table>

<tr>

<td>

stuff

</td>

<td>

<img src="../Images/RecAnimation.gif" alt="" />

</td>


</tr>

</table>


]]>

</Contents>

</DataItem>




Is it possible to turn this image on and off using JaveScript and
HideSomeParts() or somting like that?





Thanks
 
C

Cal Who

You see from the following:

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

I never see the actual markup for the img element. Only as data in the XML
file.

I could add an id to the data in the XML file but don't know how/when to add
the style to the markup.

I don't know how to go about what you suggest.

Thanks

You can assign a css tag to it if you do not want to display it.

Eitehr use
Display: none
or Visibility: Hidden

Here is a link about the differences:
http://webdesign.about.com/od/css/f/blfaqhidden.htm

Do you know if you want to display it prior to?

Miro

Cal Who said:
The master has a routine that I call in the code behind to turn some
things on or off.

smothing.Visible = Not Me.Master.HideSomeParts()

One of the content pages reads data from an xml file into a
asp:Literal <asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Organization/AccordionData.xml"
XPath="/DefaultDataItems/DataItem"></asp:XmlDataSource>

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

<ContentTemplate>

<asp:Literal Mode="PassThrough" runat="server"
Text='<%#XPath("Contents")%>' />

</ContentTemplate>

</ajaxToolkit:Accordion>





The data is html markup and is displayed on the browser.

In one case the data causes an image to be displayed

<Contents>

<![CDATA[

<table>

<tr>

<td>

stuff

</td>

<td>

<img src="../Images/RecAnimation.gif" alt="" />

</td>


</tr>

</table>


]]>

</Contents>

</DataItem>




Is it possible to turn this image on and off using JaveScript and
HideSomeParts() or somting like that?





Thanks
 
M

Miro

I thought it was this you wanted to hide ?
<img src="../Images/RecAnimation.gif" alt="" />

Do you always want to hide it? or just occasionally?

Here is what I was refering to.

Create a new webform:
add two objects as such
<asp:Image class="hideme" ID="Image1" runat="server" />

<img class="hideme" alt="" src="" />
add a dummy image into the scr's

run the program. ( you see your images )

now add a css class to it that does this:
..hideme
{
display: none;
}

now look at ur webform. ( run it as well )

See how your objects are invisible?
Still go look at this link: to know the difference between display: none and
visiblility: tags
http://webdesign.about.com/od/css/f/blfaqhidden.htm

Is that what you were trying to achieve with the image?
and if so,
when do you know / want to hide the image?

Miro



Cal Who said:
You see from the following:

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

I never see the actual markup for the img element. Only as data in the XML
file.

I could add an id to the data in the XML file but don't know how/when to
add the style to the markup.

I don't know how to go about what you suggest.

Thanks

You can assign a css tag to it if you do not want to display it.

Eitehr use
Display: none
or Visibility: Hidden

Here is a link about the differences:
http://webdesign.about.com/od/css/f/blfaqhidden.htm

Do you know if you want to display it prior to?

Miro

Cal Who said:
The master has a routine that I call in the code behind to turn some
things on or off.

smothing.Visible = Not Me.Master.HideSomeParts()

One of the content pages reads data from an xml file into a
asp:Literal <asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Organization/AccordionData.xml"
XPath="/DefaultDataItems/DataItem"></asp:XmlDataSource>

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

<ContentTemplate>

<asp:Literal Mode="PassThrough" runat="server"
Text='<%#XPath("Contents")%>' />

</ContentTemplate>

</ajaxToolkit:Accordion>





The data is html markup and is displayed on the browser.

In one case the data causes an image to be displayed

<Contents>

<![CDATA[

<table>

<tr>

<td>

stuff

</td>

<td>

<img src="../Images/RecAnimation.gif" alt="" />

</td>


</tr>

</table>


]]>

</Contents>

</DataItem>




Is it possible to turn this image on and off using JaveScript and
HideSomeParts() or somting like that?





Thanks
 
C

Cal Who

In the home page I let the user say he doesn't want to see any big images.

Then in the code behind for the content pages I call as funtion on the
master to set visibility. For example:

smothing.Visible = Not Me.Master.HideSomeParts()

Works OK but now I have this image coming in from an XML file as shown
below.

Maybe in the code behind I could search for an id that I could add to the
text in ihe XML file

Change
<img src="../Images/RecAnimation.gif" alt="" />
to
<img id="CheckID" src="../Images/RecAnimation.gif" alt="" />

Think I could, in some event search for CheckID and add a css style like you
suggested?
Or maybe just set src to ""

Not sure when in the code behind (if ever) the literal would have been
changed to the new markup.

Do I get a chance to change the new markup added with the XmlDataSource1?


Thanks



...snip

The master has a routine that I call in the code behind to turn
some things on or off.

smothing.Visible = Not Me.Master.HideSomeParts()

One of the content pages reads data from an xml file into Literals
asp:Literal <asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Organization/AccordionData.xml"
XPath="/DefaultDataItems/DataItem"></asp:XmlDataSource>

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

<ContentTemplate>

<asp:Literal Mode="PassThrough" runat="server"
Text='<%#XPath("Contents")%>' />

</ContentTemplate>

</ajaxToolkit:Accordion>





The data is html markup and is displayed on the browser.

In one case the data causes an image to be displayed

<Contents>

<![CDATA[

<table>

<tr>

<td>

stuff

</td>

<td>

<img src="../Images/RecAnimation.gif" alt="" />

</td>


</tr>

</table>


]]>

</Contents>

</DataItem>
 
M

Miro

Do you at least have the "image ID" ?

you can use javascript with the .FindControl command to do what your looking
for and then hide the image.
http://odetocode.com/articles/116.aspx

actually what if you used some javascript to do what you are looking for.
( getelementbytagname )
http://programming.top54u.com/Sampl...cument-getElementsByTagName-Loop/Default.aspx

Then you can set the visibility of the image to false.
This I havn't tried.

M.



Cal Who said:
In the home page I let the user say he doesn't want to see any big images.

Then in the code behind for the content pages I call as funtion on the
master to set visibility. For example:

smothing.Visible = Not Me.Master.HideSomeParts()

Works OK but now I have this image coming in from an XML file as shown
below.

Maybe in the code behind I could search for an id that I could add to the
text in ihe XML file

Change
<img src="../Images/RecAnimation.gif" alt="" />
to
<img id="CheckID" src="../Images/RecAnimation.gif" alt="" />

Think I could, in some event search for CheckID and add a css style like
you suggested?
Or maybe just set src to ""

Not sure when in the code behind (if ever) the literal would have been
changed to the new markup.

Do I get a chance to change the new markup added with the XmlDataSource1?


Thanks



..snip

The master has a routine that I call in the code behind to turn
some things on or off.

smothing.Visible = Not Me.Master.HideSomeParts()

One of the content pages reads data from an xml file into Literals
asp:Literal <asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Organization/AccordionData.xml"
XPath="/DefaultDataItems/DataItem"></asp:XmlDataSource>

<ajaxToolkit:Accordion ...snip... DataSourceID="XmlDataSource1">

<ContentTemplate>

<asp:Literal Mode="PassThrough" runat="server"
Text='<%#XPath("Contents")%>' />

</ContentTemplate>

</ajaxToolkit:Accordion>





The data is html markup and is displayed on the browser.

In one case the data causes an image to be displayed

<Contents>

<![CDATA[

<table>

<tr>

<td>

stuff

</td>

<td>

<img src="../Images/RecAnimation.gif" alt="" />

</td>


</tr>

</table>


]]>

</Contents>

</DataItem>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top