|
Shalini_U wrote: How to do this? Plz Reply!!!!!!!!
With code.
Shalini_U wrote: I Cannot able to access the controls of Master Page in Code Behind..
Yes you can. THe Master property, returns a MasterPage. What you need, is to upcast that to an instance of your master page class. Although, I think you should be able to handle all this permissions stuff inside the master page class itself, what I do if I ever use master page, is create a new base class for all my pages, which has a strongly typed MasterPage property that returns the upcast Master page. Then I can access the methods however I want. Of course, not being a hack programmer, I never make the controls on the master page public, I use methods and properties to allow only the required access.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Permission Means, just to check whether the user is enabled for a particular feature... So that the particular button is enabled for him... for this, I'll get the information abt the user whether the user is enabled or not from the database table. Then , I hav to set that particular button to enabled or disable. When I'm tried to get the control of Master Page, I can't do this in code behind... Is any other way to achiive this??
|
|
|
|
|
Shalini_U wrote: When I'm tried to get the control of Master Page, I can't do this in code behind... Is any other way to achiive this??
I guess you need to read my answer again, I explained exactly how to do it. And, as I said, the session should store details of who is logged in, so why can't your master page check for itself what it should show as a result ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I can't Get u... I stored the user details in session.. I can'access the controls and properties of the master page in it's cs file...
|
|
|
|
|
if You are Using forms authentication
if (Page.User.Identity.IsAuthenticated)
{
((Image)Master.FindControl("ImageButtonLogin")).Visible = false;
((Image)Master.FindControl("ImageButtonLogout")).Visible = true;
}
If this is not you are looking for sorry..!
|
|
|
|
|
Yes, this sort of thing will work, but it's ugly. Creating a strongly typed property is a far nicer solution IMO.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Shalini_U wrote: I can't do this in code behind... Is any other way to achiive this??
Ofcourse you can. I think you didn't understand what CG told you to do.
Thats the best option, but if still you need code then try this:
HtmlForm frm = (HtmlForm)Page.Master.FindControl("form_id");
Menu mnu = (Menu)frm.FindControl("menu_id");
mnu.Enabled = false;
|
|
|
|
|
Hi! Thank U.....
I used that Code... But, error occurs that "Object Reference Not set to an instance of Object"
|
|
|
|
|
where did error occurred? Can you show me your code?
|
|
|
|
|
MenuItem mnu = (MenuItem)frm.FindControl("menuitem1");
This shows error.....
I used this code now..
Menu1.Items[3].Enabled = true;
It's working for me......... Thank you for ur idea...
|
|
|
|
|
Its good that you worked it out but this is not a good way to achieve it.
It you can, try to implement the way told above.
|
|
|
|
|
you can use like this...
if(UserHasPermission)
{
Control ctr=this.Master.Findcontrol("ControlID") as Control;
ctr.Enabeled=True;
}
|
|
|
|
|
Hi,
How to access and control serial port from browser.
Thankyou,
YPKI
|
|
|
|
|
With ASP.NET, you can't. With a Java applet, you might be able to, or a C++ OCX, if you want to write a site that only works in IE.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello All,
I am facing very strange problem.
I deployed my ASP.Net application on a machine, i set up IIS, installed .Net framework, created virtual directory, set permissions.
But when i run my application in web browser, it showed me code of aspx page instead of design.
I am really confused why i am facing this problem?
Am i missing something or my aspx pages not inheriting c# code files?
Please guide me?
Thanks,
Nagendra.
|
|
|
|
|
It means that ASP.NET is not set up on your server. Run regsvr_iis ( from memory ) from the .NET folder, if you have .NET installed, so that IIS can see it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
so, is it necessary to install whole .Net on that machine? can't i do with only .Net Framework.
I couldn't find regsvr_iis on my local machine, i have .Net on my local machine.
|
|
|
|
|
Dear Nag,
You need to reinstall the .net framework here.Generally this error occurs when You install .net framework and then IIS.Install only .net framework and check it out.
if it still shows let me know.
Sundeep G
When the only tool you have is a hammer, everything looks like a nail.
Come Forth Yourself to Click "Good Answer" for any expected solution.
Let us Support our C Project Programmers who provide solutions here.
|
|
|
|
|
Thnx Sandeep, i'll try what u said and let you know what happened.
|
|
|
|
|
installing all of .NET again is just a long winded way to get that exe to run. It's called aspnet_regiis and you need to run it with the -i switch, from memory.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
This seems to be an easy option.
Thanks CG, i'll try to run it on that machine and will get back to you.
Thanks again.
|
|
|
|
|
Hello CG, i tried what you told and it solved my problem. Thanks.
|
|
|
|
|
HI all..
I Have n number of categories... and each category have n number of products...
now i have to show like
==============================================================================================================
Category 1: View All
Product1 Product2 Product3 Product4 Product5
More In Category1
==============================================================================================================
Category 2: View All
Product1 Product2 Product3 Product4 Product5
More In Category2
==============================================================================================================
Category 3: View All
Product1 Product2 Product3 Product4 Product5
More In Category3
==============================================================================================================
this is the layout Desired...
Can i use 2 datalist in which parent has vertical orientation with showing Category name... and children will show the 5 products in this category...
Is It Possible...I Have to Use Object Datasource for doing this...
and one more ques.. how i do paging for that??
Many Thanx in advance
|
|
|
|
|
How to limit the number of downloads like the site Rapidshare or Megaupload does using asp.net
123456
|
|
|
|
|
Record the IP and increase the count when each download happens. Before each download, check the current download count reached the maximum allowed limit.
|
|
|
|