|
set the session.
and then get where u want.
code listed below.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public class SN
{
public SN()
{
}
public static string UserName
{
get
{
if (HttpContext.Current.Session["UserName"] == null || HttpContext.Current.Session["UserName"].ToString().Trim() == "")
return "";
return HttpContext.Current.Session["UserName"].ToString();
}
set { HttpContext.Current.Session["UserName"] = value; }
}
}
Be afraid of a gentleman when he is hungry, and of a mean person when his stomach is full.
Zafar
|
|
|
|
|
Try to using :
HttpContext.Current.Session["SessionVariable"]
|
|
|
|
|
Hey guys need help with this
My web config file
<compilers>
Line 15: <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/warnaserror-">
Line 16: <providerOption name="CompilerVersion" value="v3.5"/></compiler>
Line 17: <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" compilerOptions="/optioninfer+">
Line 18: <providerOption name="CompilerVersion" value="v3.5"/></compiler></compilers></system.codedom>
Source File: \\shared.hosting.local\nfs\cust\0\09\78\787900\web\web.config Line: 16
Any solution ?
Thanks Thanks
KaKaShi HaTaKe
|
|
|
|
|
Please make sure that any code is in pre tags.
this
<providerOption name="CompilerVersion" value="v3.5"/>
appears twice in your web config
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi all,
I have to create dynamic menus that are coming from database. Im using asp:menu control , xmldatasource and xslt file. But im not getting the menus on my page. Can anyone help me where im wrong and what should i do/
I code used is:
<br />
CODE IN .ASPX<br />
<br />
<asp:Menu ID="Menu1" DataSourceID="xmlDataSource" runat="server" <br />
DynamicHorizontalOffset="2" StaticDisplayLevels="1" Orientation="Horizontal" ItemWrap="false" DynamicEnableDefaultPopOutImage="False" StaticEnableDefaultPopOutImage="False" ><br />
<DataBindings><br />
<asp:MenuItemBinding DataMember="MenuItem" <br />
NavigateUrlField="NavigateUrl" TextField="Text" /><br />
</DataBindings><br />
<StaticMenuItemStyle CssClass="popup" /><br />
<DynamicHoverStyle CssClass="popup" /><br />
<DynamicMenuStyle CssClass="popupd" /><br />
<DynamicSelectedStyle CssClass="popup" /><br />
<DynamicMenuItemStyle CssClass="popupd" /><br />
<br />
</asp:Menu><br />
<asp:XmlDataSource ID="xmlDataSource" TransformFile="~/TransformXSLT.xsl" <br />
XPath="MenuItems/MenuItem" EnableCaching="false" runat="server"/><br />
<br />
CODE IN ASPX.CS<br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!Page.IsPostBack)<br />
{<br />
bindMainMenu();<br />
}<br />
}<br />
<br />
private void bindMainMenu()<br />
{<br />
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cs"].ConnectionString.ToString());<br />
SqlCommand comm = new SqlCommand();<br />
SqlDataAdapter da = new SqlDataAdapter();<br />
DataSet ds = new DataSet();<br />
conn.Open();<br />
comm.Connection = conn;<br />
comm.CommandType = CommandType.StoredProcedure;<br />
comm.CommandText = "getMenuItems";<br />
<br />
da.SelectCommand = comm;<br />
da.Fill(ds);<br />
<br />
ds.DataSetName = "Menus";<br />
ds.Tables[0].TableName = "Menu";<br />
DataRelation relation = new DataRelation("id", ds.Tables["Menu"].Columns["nodeid"],<br />
ds.Tables["Menu"].Columns["parentid"], true);<br />
relation.Nested = true;<br />
ds.Relations.Add(relation);<br />
xmlDataSource.Data = ds.GetXml();<br />
<br />
comm.Cancel();<br />
conn.Close();<br />
}<br />
<br />
TransformXSLT.xsl file is<br />
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><br />
<xsl:output method="xml" indent="yes" encoding="utf-8" /><br />
<!-- Find the root node called Menus <br />
and call MenuListing for its children <br />
--><br />
<xsl:template match="/Menus"><br />
<MenuItems><br />
<xsl:call-template name="MenuListing" /><br />
</MenuItems><br />
</xsl:template><br />
<!-- Allow for recusive child node processing <br />
--><br />
<xsl:template name="MenuListing"><br />
<xsl:apply-templates select="Menu" /><br />
</xsl:template><br />
<br />
<br />
<xsl:template match="Menu"><br />
<br />
<MenuItem><br />
<!-- Convert Menu child elements to MenuItem attributes <br />
--><br />
<br />
<xsl:attribute name ="Text"><br />
<xsl:value-of select="nodeName" /><br />
</xsl:attribute><br />
<br />
<xsl:attribute name="NavigateUrl"><br />
<xsl:text>/CMSsite/pages/</xsl:text><br />
<xsl:value-of select="url" /><br />
<xsl:text>.aspx</xsl:text><br />
</xsl:attribute><br />
<br />
<!-- Call MenuListing if there are child Menu nodes <br />
--><br />
<xsl:if test="count(Menu) > 0"><br />
<xsl:call-template name="MenuListing" /><br />
</xsl:if><br />
</MenuItem><br />
<br />
</xsl:template><br />
</xsl:stylesheet><br />
|
|
|
|
|
What makes you think you are 'going wrong' ? What do you expect, and how is this code not doing what you want ?
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.
|
|
|
|
|
hi im not getting any errors but im not getting the menus displayed. data is coming from database. xml with relation is generated. But im not getting the menus
|
|
|
|
|
Hi,
How to block editing directly in the textbox of FileUpload control.
Thankyou,
YPKI
|
|
|
|
|
I doubt you can. You may be able to write some javascript which doesn't allow typing in the textbox, but the file upload as a rule is pretty heavily sandboxed, because it is a security risk.
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.
|
|
|
|
|
Add the following code to the code behind of the page.
protected void Page_Load(object sender, EventArgs e)
{
FileUpload1.Attributes.Add("onKeyDown", "if((event.keyCode == 8 ) ||(event.keyCode == 9) || (event.keyCode == 12) || (event.keyCode == 27) || (event.keyCode == 37) || (event.keyCode == 39) || (event.keyCode == 46))return true;else return false;");
}
|
|
|
|
|
Hi,
I need help regarding displaying small popup message when user mouse over the pointer the hyperlink, I have created this with javascript and it is showing the required popup onmouseover and onMouseOut it is hiding the popup using kill() method given below in code snippest but problem is whenever u scroll the page the popup msg will get displayed at the top and not on the hyperlink(onMouseOver)..
If anyone is having any idea of setting the mouse pointer to desired location or any alternate solution to show onHover popup using javascript.
Plz see code below:
//Hover Text for SSN
Xoffset= 20 //-10; //-60; // modify these values to ...
Yoffset= -25 //-150; //20; // change the popup position.
var old,skn,iex=(document.all),yyy=-1000;
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all
if (ns4)
skn=document.dek
else if (ns6)
skn=document.getElementById("dek").style
else if (ie4)
skn=document.all.dek.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else
{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;
function popup(msg,bak)
{
var content="<TABLE WIDTH=250 BORDER=1 BORDERCOLOR=#01244E CELLPADDING=2 CELLSPACING=0 "+
"BGCOLOR="+bak+"><TD ALIGN=left style='padding-left:5px;font-size:8pt;font-family:Arial;color:#01244E'>"+msg+"</TD></TABLE>";
yyy=Yoffset;
if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}
function get_mouse(e)
{
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}
function kill()
{
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}
|
|
|
|
|
My first google hit for javascript scroll position gave me this:
To save the last scroll positions (horizontal and vertical):
var hscroll = (document.all ? document.scrollLeft : window.pageXOffset);
var vscroll = (document.all ? document.scrollTop : window.pageYOffset);
then when you swap in the new form just scroll to those positions:
window.scrollTo(hscroll, vscroll);
So, you need to use the values being used in this code, to offset your menu by the scrollbar position.
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.
|
|
|
|
|
hi,,
I'm new in .Net, any one help me...
how to add multiple rows on the single datatable. without using SQL-Server.
I need to add the multiple textbox values to the Datatable.
Thanks.
|
|
|
|
|
Why do you need to add rows to a data table without using SQL Server ? Is this a homework assignment ?
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.
|
|
|
|
|
what are you exactly looking for. If datatable schema is defined use
DataRow dr = dt.NewRow()
then assign values to the fields of dr.
Finally
dt.Rows.add(dr);
you are done.
|
|
|
|
|
hello
i have a problem
i want to display image in label by retriveing the upload photo path from database i used the select path from database and reader but this is not working
|
|
|
|
|
A label cannot show an image. If the image is in the DB, you need to write a page that returns the image from the DB based on an id on the URL, and make that what an img control points to as a source.
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 i need to display an image in one page when clicked in gridview row and taking image from folder and image path is saved in database how can i retrive image
|
|
|
|
|
Rajee Maharjan wrote: how can i retrive image
Well, it's in the database, so you get it back with SQL. And then you access it in the way I told you.
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 use the code
while dr.read()
response.write(dr("imagepath").tostring())
end while
when i run not executing inside the loop what happened
|
|
|
|
|
It appears you have no idea what you're doing. I mean your ability to understand how to use an internet forum, not your code. However, I also don't see how this code is a response to my advice. Is there any point in trying to help you ? Do you know anything about programming at all ?
A response.write is useless. You need to set the content type and write it as binary data, not as a string.
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.
|
|
|
|
|
hi
i am working on a page to show how many time this page is visiting..
how can i do it..
i applied this by adding 1 on opening this page. but on revisiting this link how i prevent to increment no of view on same user
|
|
|
|
|
You would require the user to log in, and only count logged in views. Or you could store a cookie and hope they support cookies, that they don't have more than one PC and that they never delete 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.
|
|
|
|
|
you can use database table too store the value
One person's data is another person's program.
--J.Walia
|
|
|
|
|
iam adding items to the dropdownlist using javascript function while loading the page.using the webservice.now when click on save button how can i get the value selected in the dropdownlist in the code behind,my problem is that the value selected in the dropdownlist is getting null when i accessing through code behind
|
|
|
|