|
|
hi
i m using master page.In my application aspx pages are generated dynamically. is it possibile to attach them to my master page
programatically.
In my code i m doing
respponse.redirect("url");
i want this page add to my master page
|
|
|
|
|
Did you tried to give the master page name while generating the aspx page, like this.MasterPageFile = filename; . And make sure about contentPlaceHolderID in content page also.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi
Yes it is possible to attach MasterPage of your own choice in ASP.Net 2.0 or later.
You just has to set Page.MasterPageFile property in Page's PreInit Event.
Code
VB
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs)
Page.MasterPageFile = "~/MyMasterPage.master"
End Sub
</script>
C#
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_PreInit(object sender, EventArgs e)
{
Page.MasterPageFile = "~/MyMasterPage.master";
}
</script>
Remeber Page's PREINIT Event only.
Precautions:
- There must present same contentplaceholders, as in MasterPage you want to attach dynamically.
- All content palceholders Ids must match with MasterPage you are binding at runtime.
Hope it will clear the concept.
To see video tutorial for the same provided my microsoft then visit: http://www.asp.net/learn/videos/video-265.aspx[^]
From:
Gaurav Mahajan [Website: www.sushilindia.com]
Senior Website Developer and Computer Lecturer
Ga
|
|
|
|
|
Hi All,
I am using MYSql DB for backend.I have fullfill all the requirment e.g. Dot Net Connector for MYSQL etc.
Now in my application I have seen a different type of bug. One of my project I create a class clsLogin and has a following method
public int AuthenticateUser(boclsLogin objboclsLogin)
{
int inRes = 0;
using (MySqlConnection mySqlCon = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySqlCon"].ConnectionString.ToString()))
{
string strSQL = "select count(vcUSerId) from Login " +
" where vcUserId=@UserId ";
" and vcPassword=@Password" +
" and vcUserType=@UserType";
MySqlCommand _cmd = new MySqlCommand(strSQL, mySqlCon);
_cmd.Parameters.Add("@UserId", MySqlDbType.VarChar).Value = objboclsLogin.UserId;
_cmd.Parameters.Add("@Password", MySqlDbType.VarChar).Value = objboclsLogin.Password;
_cmd.Parameters.Add("@UserType", MySqlDbType.VarChar).Value = objboclsLogin.UserType;
if (mySqlCon.State == ConnectionState.Closed)
mySqlCon.Open();
inRes = Convert.ToInt32(_cmd.ExecuteScalar());
mySqlCon.Close();
}
return inRes;
}
the above method in native application works fine.But I have need the same class into a another project then i just copy paste the class File into my 2nd application it is return me a 0(scalar value).
But when i pass the hardcoded value into my query then it'll return me the 1.
So i am very phatectic,How I solve this anyone give me idea.
thanks in advance
Deepak
Smile a Lots,Its Costs Nothing
|
|
|
|
|
Hi
I do had problems with ExecuteScalar, So I suggest you just replace it with ExecuteReader and read value using DataReaderInstance(0) in vb.net DataReaderInstance[0] in C#.
Or if you are using .Net 3.5 version use LINQ to read data from database instead.
Hope this will solve your problem.
Gaurav Mahajan [website www.sushilindia.com], Amritsar
Website Developer and Computer Lecturer.
|
|
|
|
|
Hi,
I am working on a windows application in this when I click "GO to" button I have to check the browser window where my website is opened and in that I have to change the address in the address bar to another address.
or
I have to change the address in the current active browser window to the new address which will fixed by me.
Please send me reply if you know reply for any one of the above two.
Thank you.
|
|
|
|
|
hi,
let me know u want ur website in the exisiting c# application?if so use web browser control.
webbrowser1.navigate("google.com");
try this
cheers
venu gopal reddy
|
|
|
|
|
venu656 wrote: know u want ur
It very nice of you trying to help out.
Please to try to avoid txtspk.
thanks
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Nekkantidivya wrote: windows application in this when I click "GO to" button
There is no GO button on windows application? are you takling about web application?
Nekkantidivya wrote: I have to check the browser window where my website is opened and in that I have to change the address in the address bar to another address.
Why do you want to do this? You can not change the address but you can spoof it. One way is to host your page on Frames.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hi All,
i have created dynamic button and adding them to the panel, when i click the button it refresh and buttons are vanish, i want to handle event of button to show value in textbox
|
|
|
|
|
You have absolutely no idea about how ASP.NET events and dynamic controls works. ASP.NET will not maintain viewstate for the dynamic controls if it is created after the viewstate events. Please read about viewstates and ASP.NET page lifecycles.
|
|
|
|
|
|
|
i am developing a web app and i wud like to use AJAX . I am receving one other page and dispaly on my page but other page events does not work here.
Plz help.
|
|
|
|
|
prakash_adysoft wrote: I am receving one other page and dispaly on my page but other page events does not work here.
I didn't understand you problem. can you please explain it clearly?
prakash_adysoft wrote: i am developing a web app and i wud like to use AJAX
If you are new in AJAX, please start with AJAX in W3School[^]
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
i am developing a web app and i wud like to use AJAX "Adrotator control" for both images and swf files, Where cud i find these controls for free.
Plz help.
|
|
|
|
|
Subin Alex wrote: AJAX "Adrotator control"
Adrotator is not part of AJAX framework, right? Here[^] is a KB article which explains how to use it.
|
|
|
|
|
but i saw the AJAX controls for asp.net2.0 with "update panel control" suporting the Adrotator cntrol.
|
|
|
|
|
I am trying to design a CacheManager class that will automatically repopulate the cache item once the dependency changes or when it timesout without using the CacheItemRemoveCallback delegate. If anyone has developed anything similar to this and has some ideas please share them with me.
Thanks,
Steve
|
|
|
|
|
As with Session, Application, and app.config values why not just create static class such as CachedItems and do something like this?
For example, why not just do something like this?
<br />
public static class CachedItems<br />
{<br />
<br />
private static DateTime cacheExpirationDateTime<br />
{<br />
get<br />
{<br />
if (DateTime.Now.Hour < 8)<br />
return DateTime.Today.AddHours(8);<br />
else<br />
return DateTime.Today.AddDays(1).AddHours(8);<br />
}<br />
}<br />
<br />
public static YourType YourObject<br />
{<br />
get<br />
{<br />
Object x = System.Web.HttpContext.Current.Cache["YourObject"]<br />
if (x == null)<br />
System.Web.HttpContext.Current.Cache.Add("YourObject", getYourObjectMethod(), null, cacheExpirationDateTime, Cache.NoSlidingExpiration, CacheItemPriority.AboveNormal, null);<br />
<br />
return (YourType)x;<br />
}<br />
}<br />
<br />
}
I didn't get any requirements for the signature
|
|
|
|
|
Steve Holdorf wrote: or when it timesout
Why do you want to refill the cache when it time out? It will make the timing out mechanism kinda pointless.
|
|
|
|
|
I did not make this clear in the first post. What we are doing is a file cache for a web config file. Now, when the xml file changes we want to insure that the new file object (containing the config file) is updated, which I have done using properties. Also, we want to do the update on expire timeout. I see your point of not needing to update on timeout and have explained this to my boss but he feels that this is necessary? Anyway, thanks for the help.
Steve
|
|
|
|
|
Of course using the CacheItemRemoveCallback is not for refilling the cache item once called, this I know. What I do not know is what the use of the CacheItemRemoveCallback delegate is for. Can anyone give me an example?
Thanks,
Steve
|
|
|
|
|
hi
Error: ActiveX component can't create object: 'Scripting.FileSystemObject'
i detected this error in my application.
i tried to reregister the scrrun.dll
i tried to gice permission to this kind of object in the registery
i reinstalled the windows script
but the error still occur
Any advice please
regards.
dghdfghdfghdfghdgh
|
|
|
|