thienrem Ответов: 1

Как получить значение из поля ввода в коде позади ASP.NET


<div class="zoom-anim-dialog mfp-hide" id="login" runat="server">
                    <div class="popup-header">
                        <h4 class="modal-title" id="myModalLabel">LOGIN</h4>
                    </div>
                    <div class="popup-body">
                        <div class="reg_form_desc">
                            Welcome to GentekLabs
                        </div>
                        <div class="form-group">
                            <asp:TextBox ID="txtname" runat="server"  placeholder="User Name" class="form-control"></asp:TextBox>
                            <%--<input id="txtname" runat="server" type="text" name="Name" placeholder="User Name" class="form-control" />--%>
                        </div>
                        <div class="form-group">
                            <input id="txtpass" runat="server" type="password" name="txtpass" placeholder="Password" class="form-control" />
                        </div>
                        <div class="block">
                            <a href="#" id="btnlogin" class="btn btn-login" runat="server" oncli="submit();" onclick="btnlogin_Click">Login</a>
                            <a class='regislink' href="#">Forgot your password</a>
                        </div>
                    </div>
                </div>

<script>
                    $(document).ready(function () {
                        $('.popup-login').magnificPopup({
                            type: 'inline',

                            fixedContentPos: false,
                            fixedBgPos: true,

                            overflowY: 'auto',

                            closeBtnInside: true,
                            preloader: false,

                            midClick: true,
                            removalDelay: 300,
                            mainClass: 'my-mfp-zoom-in'
                            , callbacks: {
                                close: function () {
                                    $('body').css('overflow-y', '');
                                },
                                open: function () {
                                    $('body').css('overflow-y', 'scroll');
                                }
                            }
                        });
                    });
                   
                </script>


Что я уже пробовал:

protected void btnlogin_Click(object sender, EventArgs e)
    {
        string user = ((TextBox)login.FindControl("txtname")).Text;
}

1 Ответов

Рейтинг:
2

OriginalGriff

Хм....

protected void btnlogin_Click(object sender, EventArgs e)
    {
    string user = txtname.Text;
    ...
    }