简体   繁体   中英

C# .NET Button with Bootstrap Modal Doesn't fire in server

In my .net C# project I use repeater to display data, For each repeater item I have a "EDIT" button that should pops up a modal with the relevant data. I want the button would display the Modal and also load the relevant data from the server I tried to use:

<asp:LinkButton runat="server" id="btn_done2"  CssClass="btn btn-primary btn-lg"     OnCommand="loadEventToLoad" CommandArgument='<%# Eval("ID") %>'
                        data-toggle="modal" data-target="#myModal">EDIT</asp:LinkButton>

The Result is: only the modal popsup and the Command doesn't fire at all any way to fix it without make the load from the client side?

I think you need to use a href without runat = sever tag. This way you can open up without firing a server side event.

If you want to access the contents of your modal, then you will need to put an UpdatePanel in the modal first. Then, you can wrap your Button in an UpdatePanel and you should be able to debug the postback and modify the contents.

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