简体   繁体   中英

ASP.NET + C# + jQuery: Click on a datalistItem which is a div then ItemCommand event will be fired?

I have an ASP.NET datalist like this:

<asp:DataList ID="DataList_Trips" OnItemCommand="DataList_Trips_ItemCommand" >
    <ItemTemplate>
        <div class="divListTrips">
        </div>
    </ItemTemplate>
</asp:DataList>

Is there any chance when I click on the div with the class divListTrips, it will fire the event OnItemCommand?

I would suggest using jQuery to call a page method, like in the example Using jQuery To Call ASP.NET Page Methods and Web Services .

Instead of trying to coerce it to, call your ItemCommand handler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM