|
OK, it's easy then. The ASPX is executed *first*, you can't make this happen after your event is fired. So, you need to change how the code works, for this to work. You'll need to probably use CSS, and write the CSS classes out inside your prerender. Your problem all along has been what I said, even if it took me a while to nut out hte detaisl. The values in your cookie get written out *before* your event changes them.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi Christian, okay! So you are saying that aspx (the server side code in their) is executed first before the button is clicked.
Alright so if you notice in the code sample at gotdotnet site i sent you, they are using an inline CSS (unless I'm totally wrong). So if I understand you correctly, you are saying that some how don't call that GetStyle() method from the aspx page like this
<table style = "color:<%=GetStyle("ForeColor") %> (BTW this is CSS inline version right??).
Could you give me an example of how to use classes like you mentioned?
I'm thinking there's got to be a way to get this to work even without the external style sheet. In other words like you said do it from within pre-render but with this same style sheet.
Please help
Thanks
~TINA
|
|
|
|
|
<table style='myCSS'>
would mean the table gets it's CSS from the myCSS class. Your code behind can now write the CSS class into the page, and thus define the style sheet there. The other option is to ditch the aspx code and set properties on the table itself ( that is, give it a name and access it's properties in the code behind ). A third ( somewhat nasty ) option is to have the event handler store the cookie, then redirect to itself, so that it starts the page lifecycle all over again.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Cool, thanks Christian. I think I'm thinking about using the second approach you mentioned. Use the ID of table and body to change the color, but I wonder if this will work for the font color, font size and font name properties as well???? Because I'm changing those as well???
Thanks
~TINA
|
|
|
|
|
Christian, like i was wondering earlier in my response...from code behind it does change the backgroundcolor
theBody.Attributes["bgcolor"]= Convert.ToString(GetStyle("BackColor"));
But it doesn't have any properties for the font size, font name etc.
In other words I can't do something like this:
<br />
theBody.Attributes["font-size"] = GetStyle("FontSize");
theBody.Attributes["font-style"] = GetStyle("FontName");
Am I doing something wrong here???
Thanks
~TINA
|
|
|
|
|
Dear all,
i am making web application using Asp.net,C#(VisualStudio2005).in a web page there is a dropdownlist control
on edit command, i am trying to populate it as
for (int i = 0; i < DropDownListprob.Items.Count; i++)
{
if (rdr["ProbCode"].Equals(DropDownListprob.Item[i].Text))
{
DropDownListprob.Items[i].Selected = true;
//MessageBox.Show(DropDownListprob.Items[i].Text);
}
}
but it is showing error as follow. i have only three record in dropdownlist. adn i am populating one of them.i am not able to understand the porblem as it is showing multiple item can not be selected.
Error showing
Cannot have multiple items selected in a DropDownList.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.
regards
imran khan
|
|
|
|
|
Hi,
There is No logical error with you code.
You may Check the 'DropDownListprob', whether it contains Unique Values ( No Repeated Items). AND also, whether the 'DropDownListprob' already have any selected Items.
Regards,
Jay
|
|
|
|
|
mohd imran abdul aziz wrote: for (int i = 0; i < DropDownListprob.Items.Count; i++)
{
if (rdr["ProbCode"].Equals(DropDownListprob.Item[i].Text))
{
DropDownListprob.Items[i].Selected = true;
//MessageBox.Show(DropDownListprob.Items[i].Text);
}
}
mohd imran abdul aziz wrote: Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.
Shows that the some items in the DropDownList are same... check the DropDownListprob.Items[i].Text.
|
|
|
|
|
Hi,
My query is as follows...
I have set of documents stored using Sharepoint(document management tool). I have to search for a particular keyword or phrase in the content of all the documents stored through sharepoint and get the list of documents result whose content containe the searched keyword.
I am new to sharepoint, could anyone of you help me with the code for the logic above....
Thanks in advance.....
Usha
|
|
|
|
|
Hi,
I am working on a .Net web based application and like to setup auto logout when the user closes the browser. This is what happening so far,
I am creating the Form authentication ticket manually and setting up the expiration for 5 minutes. So whenever the user leaves the application ideal for more than 5 minutes it will ask them to login for next request. But when they closes the Browser window without logged out manually and opening the browser immediately they are logged in already, but it is asking them to login when they open the browser after 5 minutes.
But I want to keep the timeout function as it is and like to logout the user immediately when they close the browser.
I tried it with adding code FormAuthentication.singout(); Session.Abandon(); to Application End and session end of global.aspx.cs, but nothing worked.
Is there any other way of doing it?
PS: Using .Net 1.1
Please help me.
Thanks and Regards,
Renu
|
|
|
|
|
You don't have much of a choice, since the browser is obvious on the client and not connected to the server there is no event generated when a user closes the browser.
A work around may be to handle the closing event on the client-side (i.e. javascript) and use some AJAX call to sign the user out at the server.
only two letters away from being an asset
|
|
|
|
|
Closing event on the client-side is not a correct way to do this process., because if the location of the browser is changed then also Closing event will be fired.
(i.e)
Page A has the closing event.
If Page A is redirected to Page B, then A's Closing event will be fired.
If you are using Frames or IFrames then this is possible...
|
|
|
|
|
Yes the closing event does get fired when the browser is navigated to another page, however it is possible to use this event for the requested feature. I have done it.
Please give your solution.
only two letters away from being an asset
|
|
|
|
|
We can still use Closing event, if we use Frames or IFrames...
|
|
|
|
|
It is possible even without frames. Again, I've done it.
only two letters away from being an asset
|
|
|
|
|
Hi Venkatesh and Mark,
Thanks for your help and your priceless time for me.
I just removed the code which was setting up the expiration time for the authentication cookie and it is working alright.
Previously i had code
authCookie.Expires = DateTime.MaxValue;
when creating the authentication ticket.
I removed this code and now the user session is getting logged off once the user closes the application browser window.
Thanks a lot!!
Renu
|
|
|
|
|
Yeah I have used frames but not in all pages... is it still possible? If so can you explain me how to do it?
|
|
|
|
|
While i was experimenting with code i found out that when the browser (IE) is being closed (NOT WHEN BEING REFRESHED) client screen left-top coordinate (window.screenLeft) is returned a strange 10004.
<script>
window.onunload=unloadEvent;
function unloadEvent(){
if(window.screenLeft < 10004){
}
else{
}
}
</script>
This code is tested and works fine in IE 6.0.2 as I have installed. It will fail in Mozilla/Opera (I think).
-- modified at 23:22 Thursday 4th January, 2007
|
|
|
|
|
Sorry, though it sounds like an excuse I can't provide an example as it was done for a client and I don't have the rights to the code. Legalities.
However the basic are as follows. Handle the event, determine if the client is leaving your site, either via closing the broswer or navigating away, then make an out of band call (i.e. AJAX) to a method or web service on your server.
only two letters away from being an asset
|
|
|
|
|
Total .NET novice here- I'm trying to determine the best way to display database content, specifically single records. Coming from an ASP/vbscript/SQL Server background, I use stored procedures for basically everything.
I experimented with the FormView and DetailsView, but they both seemed to add a lot of superfluous HTML. I then downloaded one of the sample projects (ecommerce) from the ASP.NET site which was extremely helpful - showing how database calls could be moved into public classes with values passed to variables on page load (much more familiar territory for me). I was able to modify the code to connect to my own database and display some content, but moving forward I'm curious what the best approaches are for doing this. Is there anything in the VS IDE that expedites this process, or am I going about the whole thing from the wrong perspective?
Any insights would be appreciated.
Using VS2005 / ASP 2.0 / C#, if it matters.
|
|
|
|
|
I'm sure you could get a lot of different opinions on this. As for me, I'm finding that I'm building data access tiers more and more, even in simple applications. I might have a class called "Product" with properties that match data fields, then a method like "GetProductById(int id)" in a data access class that returns a Product object. My .aspx page will call this data access method and work with the returned Product object, rather than directly make database calls itself.
|
|
|
|
|
You can use a DataSource control to bind the data to the control(s). Using a SqlDataSource you can easily configure it use a stored proc, or sql statement. Likewise, using an ObjectDataSource you can point to an object that exposes methods, such as a data access tier class.
only two letters away from being an asset
|
|
|
|
|
in my ASP.NET application i have a Master Page and some no of child pages.The master page contains a menu bar(normal navigation thingie) now one of my child pages i need to have a tab strip.The problem here is that when the page loads master page menu control goes beneath my tab strip hence does not become visible!!!!! i am kinda newbie to ASP.NET can some one advise how do i go about doing some thing like this
nikhil
|
|
|
|
|
anikhil wrote: master page menu control goes beneath my tab strip
Sounds like you need to brush up on your web design techniques.
You need to put the Page Content part of the master page in an area of the page that won't be used by the master page.
This article[^] explains how to use divs and style sheets to layout your page in a fairly standard manner. Just ensure that your page content is in the main content area, and the menu bar is in the header or sidebar areas.
Hope that helps.
|
|
|
|
|
I use the following code to export a page to excel. My problem is that i can't change the sheet name in excel file its always the physical name of the page not even its title!
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
Response.AddHeader("content-disposition", "inline;filename=MyExcelFile.xls");
marcoryos
|
|
|
|