|
the property is static, that is the problem
why do you not just access the session var, rather than store it in another class?
else you will need to get complicated, if you want to keep the property static and keep an IDictionary<sessionId, propertyValue> in the object and return the appropriate value for the users session.
other option, *cleaner* than static property, but less clean that just accessing session var, is to create an instance object for each session like.
new SessionInfo().FullName = Session["fullname"] as String;
hope this helps
g00fy
|
|
|
|
|
How can I change the color and style of an asp.net form?
Regards,
Thomas
|
|
|
|
|
|
How can I make an multilanguge application in asp.net ?
,,,,,,,,,,,,,,,,,,.................,,,,,,,,,,,,
|
|
|
|
|
|
|
Hi *.*,
I've got a user-control with 3 Dropdowns, A, B and C. If the user selects something in A, the content of B should change depending on the value selected in A. I sure could do that by reposting the page on every selection change. What I'd rather do is to send all possible values wrapped up in some javascript to the client. Can somebody give me a starting point on how to cope with this?
-> How do I attach Javascript to the Dropdowns change event?
-> How to send all values to the client?
thanks in advance!
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
i would use ajax for this, if this is not possible then look here,
http://javascriptkit.com/script/script2/multiplecombo.shtml
plenty of e.g's on that site
hope that helps,
g00fy
|
|
|
|
|
I am having a problem with a asp:menu 2.0 control. When I set up the control to use an XmlDataSource the postback event doesn't fire for all the menu items. i.e. I have a OnMenuItemClick event, but it only fires for the items under the first menu entry. Here is the aspx markup:
<asp:Menu ID="mnuMain" runat="server" Orientation="Horizontal" OnMenuItemClick="mnuMain_MenuItemClick" DataSourceID="xmldsMenu">
<DataBindings>
<asp:MenuItemBinding DataMember="MenuNode" NavigateUrlField="url" TextField="title" ValueField="value" />
<asp:MenuItemBinding DataMember="MenuNode" NavigateUrlField="url" TextField="title" ValueField="value" />
</DataBindings>
</asp:Menu>
<asp:XmlDataSource ID="xmldsMenu" runat="server" DataFile="menu.xml" XPath="/MapHomeNode/MenuNode">
</asp:XmlDataSource>
-- modified at 7:15 Wednesday 6th September, 2006
|
|
|
|
|
Hi there. What does your xml file look like?
|
|
|
|
|
hi all,
i am converting my custom control from a flow layout to a more configurable layout using div's (System.Web.UI.WebControls.Panel ). The control has a couple of buttons on it that work fine if i just render them within the custom control and not put them in another controls control collection.
As soon as i put the button/s into another controls control collection, the events dont fire. I have created a class WebPanel that extends Panel and implements INamingContainer but that doesn't help either. The same problem occurs also if I use a Table instead of a Panel
this is my overriden OnBubbleEvent
protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is CommandEventArgs)
{
CommandEventArgs e1 = (CommandEventArgs)e;
Button button = source as Button;
OnClick(this, new ButtonEventArgs(button));
return false;
}
return true;
}
this is my overriden CreateChildControls
protected override void CreateChildControls()
{
Controls.Clear();
Button button = new Button();
button.Text = "Button1";
button.CommandArgument = "Button1";
this.Buttons.Add(button);
}
btw, this.Buttons is a custom ButtonCollection that has a ButtonAdded event, which adds the Button to the Controls collection
This renders & events fire
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
foreach (Button button in Buttons)
{
button.RenderControl(writer);
}
}
This renders & event *dont* fire
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
Panel container = new Panel();
Controls.Add(container);
foreach (Button button in Buttons)
{
container.Controls.Add(button);
}
container.RenderControl(writer);
}
Any ideas please.
g00fy
|
|
|
|
|
Hello
first you should be implements inamingcontainer class
Implements INamingContainer
Softy Boy
|
|
|
|
|
thanks for the reply
but ... i am implementing that else it would not fire the event when *not* contained within the control collection of the other control.
regards,
g00fy
|
|
|
|
|
hello,
pls check object scope, it's mean i think it's not live in memory still raising events of control.
Softy Boy
|
|
|
|
|
Hi there,
Can you try to explicitly specify the ID property for the button control in the CreateChildControls method?
|
|
|
|
|
tried that and it is the same problem
thanks for the reply
goofy
|
|
|
|
|
IMO, in this case the ids of the dynamic buttons are different when the parent control is rendered and when it is created on postback. And as a result of this, the postback event cannot be routed to the button's Command event. You can try debugging your application and double check the ID property of the dynamic buttons and see if this is the case.
|
|
|
|
|
i will try that now,
not sure if this helps but the following code produces two lines of buttons and neither fire the event, normally the button.RenderControl(writer); LOC would fire but as soon as i add the button to a controls control collection it failes everywhere
protected override void Render(HtmlTextWriter writer)
{
EnsureChildControls();
Panel container = new Panel();
foreach (Button button in Buttons)
{
button.RenderControl(writer);
container.Controls.Add(button);
}
container.RenderControl(writer);
}
am debugging extensively as we speak
thank you
g00fy
|
|
|
|
|
When you add the button to the container (panel), it will be removed from its current parent (that I guess is the custom control). When the postback occurs, the dynamic button does not exist as the child control of the panel, and you may notice this thing.
|
|
|
|
|
the approach i have taken, until i can find a better solution is to ...
render all other controls not requiring events, using Panel Controls, and explicitly render the buttons using the writer, and not contain them within another Control.
this works fine, although not perfect for my needs.
thank you *again* for all your help
kind regards,
g00fy
|
|
|
|
|
hello
i'm making a project in asp.met with vb.
I have a .htm file in the my application folder. what I want, I want to read the htm file and want to write some text in this .htm file ona particlualar position.
exactly i have to write the text before the tag by through script.
any body can help me.
|
|
|
|
|
Hi,
Is that .htm file contains simple text are with animations? If text means it's easy to read it using file streame and write your text in that in an specific position
bye
|
|
|
|
|
if the source file is never changed, i.e you always save as a different file and use the source file as a template, this may help.
add a comment into the HTML file, like:
then just do a string replace like so.
string str = System.IO.File.ReadAllText(filepath);
str.Replace("<!-- {PLACEHOLDER} -->", "some text to put into the HTML file");
System.IO.File.WriteAllText(savepath);
otherwise if the file is always changing and you are always needing to insert and not remove then this may help
string str = System.IO.File.ReadAllText(filepath);
str.Replace("</body>", "<script type=\"text/javascript\">alert('script inserted');</script></body>");
System.IO.File.WriteAllText(savepath);
otherwise you will need to use regular expressions i think, unless you can supply more information
hope that helps
g00fy
|
|
|
|
|
hi
thanx for the valuable reply..actually i want to use google analystic into the site.
what is exactly i want to do when any user create his site then this javascript code
"
_uacct="UA-xxxx-x";
urchinTracker();
"
I have to Insert this code before tag.
You suggested that i have place a comment into the Template file.this is ok and will work but measure problem is that when user will upload his template then there will be no Comment then how will get this comment.any suggestion.
|
|
|
|
|
it appears this is a once off insertion, so you can use my last suggestion to replcae the tag and prefix it with your code.
regards,
g00fy
|
|
|
|