how to use user control in asp.net

Posted by Gow.Net under ASP.NET on 7/5/2012 | Points: 10 | Views : 3159 | Status : [Member] | Replies : 7
hi in my project i am using login form for admin and user role so i use usercontrol fro create login process here i create
txt_uname.Tex and txt_password
.Text in usercontrol page(.ascx) and Submit button create in webform(.aspx) page ok.
after click submit button in the click event i write my coding here how to access the
txt_uname.Tex and txt_password

here attach sample plz any one help me

gowthaman8870226416


Responses

Posted by: Anu.Malik on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
Hi ,

You can use FindControl to access textBoxes inside UserControls Like this

TextBox txt_username =(TextBox)ucl_login1.FindControl("txt_username");
TextBox txt_pwd = (TextBox)ucl_login1.FindControl("txt_pwd");




Thanks & Regards ,
Anu Malik

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Premalatha on: 7/5/2012 [Member] Starter | Points: 25

Up
0
Down
Go to read this link,
You will get the Answer

http://asp.net-tutorials.com/user-controls/using/

Premalatha
Software Engineer

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 7/6/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

First you need to Register that control in your page and then include that control at place where you want


Regards

R D Patel

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raghumv on: 7/6/2012 [Member] Starter | Points: 25

Up
0
Down
call .ascx control in .aspx page
call
<%@ Register TagPrefix="uc1" TagName="tagName" src="UserControl Path"> in aspx page

Raghu.M.V.
Software Engineer.

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Premalatha on: 7/6/2012 [Member] Starter | Points: 25

Up
0
Down
hi

what u want to do with controls inside ucontrol from aspx page

if u want to bind them create public methods in side u.control and call from aspx page

or
For example;
check these link

http://www.dotnetcurry.com/ShowArticle.aspx?ID=155&AspxAutoDetectCookieSupport=1

http://bytes.com/topic/asp-net/answers/480786-access-user-control-s-control

Premalatha
Software Engineer

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 8/6/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
Hi... @Gow.Net
find ur attached sample file.
 Download source file

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response