Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / July 2003

Tip: Looking for answers? Try searching our database.

Double-click Event Attribute on Datagrid Item

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alan Z. Scharf - 29 Jul 2003 16:34 GMT
1. Is it possible to define an "OnDoubleClick" event attribute for a
datagrid item?

2. I have code below which selects a datagrid row with the "OnClick"
attribute, but apparently there is no built-in OnDoubleClick attribute.

Thanks.

Alan

Code - Using Datagrid Item OnClick Attribute
------------------------------------------------------
public void dgHoldings_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if( (itemType == ListItemType.Item) || (itemType ==
ListItemType.AlternatingItem) )
{
LinkButton linkButton = (LinkButton) e.Item.Cells[7].Controls[0];
e.Item.Attributes["OnClick"] = Page.GetPostBackClientHyperlink(linkButton, "
");
}
else
{
return;
}
}

________________
Alan Z. Scharf
GrapeVine Systems
New York City
Tian Min Huang - 31 Jul 2003 17:00 GMT
Hello Alan,

According to my understanding, you want to handle the doubleclick event for
LinkButton. Please correct me if there is any misunderstanding. And I'd
like to share the following information with you:

As you know, the LinkButton is interpreted as hypertext link on the client
side which supports ondblclick event. You can handle in this way:

1. In the form class:

    public class WebForm1 : System.Web.UI.Page
    {
        ......
        private void Page_Load(object sender, System.EventArgs e)
        {
            this.LinkButton1.Attributes.Add("ondblclick", "handleDblClick()");
        }
        ......
    }

2. Add the following code in the .aspx file:

     <HEAD>
        ......
        <SCRIPT language="javascript">
        function handleDblClick()
        {
                alert('hello');
        }
        </SCRIPT>
    </HEAD>

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ?C www.microsoft.com/security
This posting is provided ??as is?? with no warranties and confers no rights.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.