0

Here's the modal:

<div class="modal fade" id="messmodal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <div class="modal-title">
                        New Message to <% Response.Write(Session("tempsess")) %></div>
                </div>
                    <button type="button" class="btn btn-primary">
                        Send</button>
                </div>
            </div>
        </div>
    </div>

Here's the link button that launches the modal:

     <asp:LinkButton ID="LinkButton1" runat="server" 
     CssClass="btn btn-success fa fa-comments-o" 
     OnCommand="getshisid" CommandArgument='<%# Eval("profile_id") %>' 
     data-toggle="modal" data-target="#messmodal">
     </asp:LinkButton>

And here's the code behind for the link button:

Sub getshisid(ByVal Sender As Object, ByVal e As CommandEventArgs)
        Dim commandArgsAccept As Integer = e.CommandArgument
        Dim proid As Integer = commandArgsAccept
        Session("tempsess") = proid
        Dim prosess As Integer
        prosess = Convert.ToInt32(Session("tempsess"))
        Response.Write(prosess)
    End Sub

Without using the following line in the link button, the code-behind works perfectly:

data-toggle="modal" data-target="#messmodal"

Once this line is re-included, the button only opens the modal and the code-behind doesn't function.

How'd I go around this?

Ishaan Patel
  • 61
  • 13

1 Answers1

1
LinkButton1.Attributes('data-toggle') = 'modal';

This should work. using data-toggle wont use, as the - is literal.

Reference topics:

Community
  • 1
  • 1
Chris
  • 26
  • 4
  • Thanks for the reply! But I'm working with vb.net. And all I'm looking forward to do is launch the modal and store the session value on clicking that link button. The session value will be used in the modal too. – Ishaan Patel Oct 29 '15 at 16:33