Hello
I have a master page where ive placed my login controls inside a div tag. On my home page that inherited the master page i wnat to access the div tag to hide the div tag when login is successful.
I've tried the directive
%@MasterType VirtualPath="master1.master%
i've named the div id on the master "Login" hoping i can access it on the inherited page.
Can anyone maybe assist me with this...
Thank you
Loading
Sanjeeb LenkaPosted Jul 24, 2013, 5:23 AM
1st in master page declare your div like following:
2nd in child page you can access it by following code:
add the reference:
using System.Web.UI.HtmlControls;
HtmlGenericControl myObject;
myObject = (HtmlGenericControl)Master.FindControl("Login");
myObject.Visible = false;
on1st highlighted is your div id
Sanjeeb LenkaPosted Jul 24, 2013, 6:50 AM
can you plz put this question in other thread because its not coming clearly in this tread. may be some design problem in this thread. plz put it on other thread i will help you.
alrodean fransmabPosted Jul 24, 2013, 6:35 AM
The label thats suppose to populate with the username and say "Welcome Alrodean , you are now logged in" is not showing on the home page. This label is also on the MasterPage. I tried to access it using the HtmlGenericControls but it says cant cast Web.UI.WebControls with Web.Ui.HtmlControls
That div is displaying
so i am tryiing to access the "lbl4" and populate that with the username if it is successful on the home page.
Sanjeeb LenkaPosted Jul 24, 2013, 6:14 AM
try to do it by checking it form database on login button click.
if login success then store the username in session and show the success page else show msg wrong user id.
alrodean fransmabPosted Jul 24, 2013, 6:09 AM
System.Web.UI.HtmlControls;
if i could send the thing im trying to do then you will what im actually doing...
I am new to asp.net and still learning alot i try to do more than what i am required. I am currently making a website "Project" but i would like to use a login as one feature i thought it would be cool, but its turning out to be more challenging than what i thought. I have 3 pages that does the login.
1st page. will have the controls on like textboxes etc and saving the sessions form the 2 textboxes "Username and password", once you click login it will go a second page, this is where i put a gridview and used the sessions to search the gridview for a match. if a match is found it directs back to the home where the
does it seem right what im doing?
Riyaz AkhtarPosted Jul 24, 2013, 5:54 AM
alrodean fransmabPosted Jul 24, 2013, 5:22 AM
alrodean fransmabPosted Jul 24, 2013, 5:19 AM
Riyaz AkhtarPosted Jul 24, 2013, 5:14 AM
try below code in ur home page: