开发者

Manually fetch values from asp.net control

开发者 https://www.devze.com 2022-12-18 03:45 出处:网络
I have a FormView control with Two text Boxes. Data source for the Controls is an ObjectDataSource I want to fetch these values from both text boxes, create a User object and pass it to ObjectDataSo

I have a FormView control with Two text Boxes. Data source for the Controls is an ObjectDataSource

I want to fetch these values from both text boxes, create a User object and pass it to ObjectDataSource, which has an input method that accept a Us开发者_运维百科er object

I think I have to do it in

protected void ObjectDataSourceUsert_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
        {  
            // string _userName = FormViewUserDetails. ?
            // string _password = FormViewUserDetails. ?

            User user = new User {UserName = _userName, Password = _password};
            e.InputParameters.Add(user);    
        }

Thanks


If you're trying to find the controls inside the formview, you can use

TextBox myTextBox = (TextBox)MyFormView.Row.FindControl("controlID");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号