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?

1 Answer 1

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

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

Reference topics:

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.