Show div using Ajax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

on click of a link, i'm sending an ajax call to the server, grabbing relevant
data, and trying to display it by adding a datagrid to a hidden div, making
it visible, and moving it to the front. But when my function is complete,
the div remains in its original state... anybody point me in the right
direction?

Even if all i try to do is show the div, it still isn't working... I tried
both styles, and the visible property.

<div id=divLOs runat="server">abbazabba</div>

divLOs.Style.Item("display") = "block"
divLOs.Visible = True
 
PokerJoker said:
on click of a link, i'm sending an ajax call to the server, grabbing relevant
data, and trying to display it by adding a datagrid to a hidden div, making
it visible, and moving it to the front. But when my function is complete,
the div remains in its original state... anybody point me in the right
direction?

Even if all i try to do is show the div, it still isn't working... I tried
both styles, and the visible property.

<div id=divLOs runat="server">abbazabba</div>

divLOs.Style.Item("display") = "block"
divLOs.Visible = True

I'm assuming you're using JavaScript to show the div. Here's my attempt
at getting it working:


<div id="divLOs" style="display: none;">abbazabba</div>
<script type="text/javascript">
var divLOs = document.getElementById('<%= divLOs.ClientID %>');
divLOs.style.display = "block"; // or divLOs.style["display"] = "block";
</script>


Visible is an asp.net property that determines whether the element is
rendered in the html. You will want Visible to be true and set
display:none when the page loads.

Also, you might not need (or want) the div to have runat="server".
Unless, that is, you access it in server code. If you remove the
runat="server" you can change '<%= divLOs.ClientID %>' to 'divLOs'.
 
David, thanks for the reply, but i'm trying to make it visible server side,
first thing I do is populate a datagrid with items based on what record was
clicked, then I add that control to the div, and then finally try to display
it. The code doesn't seem to be working, but then if I grab the linkbutton
like so

Dim btn As LinkButton = e.CommandSource

and set the btn.text to something , it updates on the page just fine.

David Hogue said:
PokerJoker said:
on click of a link, i'm sending an ajax call to the server, grabbing relevant
data, and trying to display it by adding a datagrid to a hidden div, making
it visible, and moving it to the front. But when my function is complete,
the div remains in its original state... anybody point me in the right
direction?

Even if all i try to do is show the div, it still isn't working... I tried
both styles, and the visible property.

<div id=divLOs runat="server">abbazabba</div>

divLOs.Style.Item("display") = "block"
divLOs.Visible = True

I'm assuming you're using JavaScript to show the div. Here's my attempt
at getting it working:


<div id="divLOs" style="display: none;">abbazabba</div>
<script type="text/javascript">
var divLOs = document.getElementById('<%= divLOs.ClientID %>');
divLOs.style.display = "block"; // or divLOs.style["display"] = "block";
</script>


Visible is an asp.net property that determines whether the element is
rendered in the html. You will want Visible to be true and set
display:none when the page loads.

Also, you might not need (or want) the div to have runat="server".
Unless, that is, you access it in server code. If you remove the
runat="server" you can change '<%= divLOs.ClientID %>' to 'divLOs'.
 
Back
Top