C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




How to pass div id in gridview rowdatabound for javascript


Posted Date: 18 Jul 2008      Total Responses: 1

Posted By: sandhya bhavani       Member Level: Gold     Points: 1


In gridview same treeview type elements shuld display.once i press the plus image in gridview elements shuld populate under the element.
hw i did

in gridview i took one template field in tat one image,database column and one div tag(4 link buttons)
once i press the image div shuld be shown and again press the image div shuld be invisible.

in rowdatabound im calling javacript function
in ths i need to pass div id how to pass div id in gridview
Dim imgUp As Image = DirectCast(gvCircle.FindControl("imgDown"), Image)
Dim div as
imgUp.Attributes.Add("onclick", "ShowDiv('" + imgUp.ClientID + "','" + +"')")

Plese can u help me out

Thanks
sandhya.




Responses

Author: LakshmiRameshCherukuri    21 Jul 2008Member Level: SilverRating:     Points: 6
Hi,

I do have come across similar situation in my previous proj...
But I didn't used datarowbound event... instead I have passed it as parameter in the javascript itself...
To the ChangeImage function I passed the Image ID.. similarly you can pass your Div ID.. hope it works for u..


function ChangeImage(i)
{
var newImagePath = document.getElementById(i).src;
document.getElementById('NewImage').src = newImagePath;
}

<ItemTemplate>
<table border="1">
<tr>
<td style="width: 11px">
<a href="" id="aImg" runat="server" > <img src='<%# "~/Files/" + DataBinder.Eval(Container.DataItem, "ProductImage") %>' runat="server" onclick="ChangeImage(id);" id="ProductImage" alt="" height="100" width="100" /></a>
</td>
</tr>
</table>
</ItemTemplate>


Regards,
Lakshmi Ramesh



Post Reply
You must Sign In to post a response.
Next : How to close an ASP.Net active web page
Previous : Can any one give me the Best sites to learn .net?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

Help Desk

Contact Us    Privacy Policy    Terms Of Use