|
Create a class to access your session objects if this is what you require and reference this class from your pages. It's not good practice to have your aspx pages referencing each other in this fashion.
|
|
|
|
|
why don't u make a base class and derive your second and third class from that class
and in your base class u write the code to read the session
|
|
|
|
|
When you create an instance of a page class yourself, it's just an instance of a class, it's not connected to anything. If you call any methods in the object, it won't be able to use anything that is normally available in a page.
Put any code that you want to reuse in a separate class, and use that from both pages.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
Thank you all for your valuable suggestions.
I used the following code in the function objSecond.RetrieveFromSession()
before accessing the session.
Dim Session As System.Web.SessionState.HttpSessionState
Session = HttpContext.Current.Session
It worked. Now im able to access the session value this way by referring the current session variable.
Now i got two more problems in the same function objSecond.RetrieveFromSession()
1) Im not able to access the viewstate values of the base page. How can i access the viewstate through this function?
2) In my Login page ,i have set
FormsAuthentication.SetAuthCookie(strUserID, False)
Now, im not able to access the value by using
Page.User.Identity.Name.ToString() in the function objSecond.RetrieveFromSession()
But in the base page im able to acces it directly.
Plz suggest some way to solve this.
|
|
|
|
|
Hi in my datagrid i am using data formatting expression for the boundcolumn{0:N} like...,
So after decimal its giving two digits...,
Now i try to store the value in my table...,
so using this code i get the value & try to store in my table:
For Each MainGRD As DataGridItem In Me.dgrdmain.Items
Dim Hra As Decimal = Val(MainGRD.Cells(10).Text)
...
//here using store procedure i try to store the value in my table
Next
But if the value will display like: 14,567.87
then its store only 14 in my table...,
If i remove data formatting expression...,
Then its store full value to my table like 14567.875432 like...,
Plz i want the solution how to store the proper value with data formatting expression to my table...,
Plz any solve my probs....................,
Magi
|
|
|
|
|
one dirty way of doing that
u can change the datatype of your sql field to string/varchar (if it is not string)
|
|
|
|
|
Hi all...
Here i read xml from a string and i kept in a data set
Dim myDS As DataSet = New DataSet
Dim myTable As DataTable = New DataTable("DOList")
myTable.Columns.Add("OtherData", Type.GetType("System.String"))
myDS.Tables.Add(myTable)
Dim xmldata As String = strXMLString
Dim xmlsr As StringReader = New StringReader(xmldata)
myDS.ReadXml(xmlsr, XmlReadMode.IgnoreSchema)
next i have to read that xmldocument and i need to get some node .but i am not getting hoe to retrieve that xml document in data set can u please help me.
Suresh.R
|
|
|
|
|
your question is not clear....
you asked in the subject line
sooreeagt wrote: how to get the xml from dataset
but inside you explained sth else
pls explain it properly
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
a code to read xml document and display it's properties in richtextbox
------------------------------------------------------------------------
XmlTextReader srd = new XmlTextReader("e:\\newschemafile.txt");
richTextBox1.Text = "XmlTextReader Properties Test\n";
while (srd.Read())
{
if (srd.NodeType == XmlNodeType.Element)
{
richTextBox1.Text += "===================\n";
// Read this element's properties and display them on console
richTextBox1.Text += "Name:" + srd.Name + "\n";
//richTextBox1.Text += "Base URI:" + srd.BaseURI + "\n";
//richTextBox1.Text += "Local Name:" + srd.LocalName + "\n";
//richTextBox1.Text += "Attribute Count:" + srd.AttributeCount.ToString() + "\n";
//richTextBox1.Text += "Depth:" + srd.Depth.ToString() + "\n";
//richTextBox1.Text += "Line Number:" + srd.LineNumber.ToString() + "\n";
//richTextBox1.Text += "Node Type:" + srd.NodeType.ToString() + "\n";
//richTextBox1.Text += "Attribute Count:" + srd.Value.ToString() + "\n";
//if(srd.NodeType == XmlNodeType.Text)
richTextBox1.Text += "Value" + "\n";
if (srd.Name == "Parameter")
{
richTextBox1.Text += "name: " + srd.GetAttribute("name") + "\n";
richTextBox1.Text += "table: " + srd.GetAttribute("table") + "\n";
}
else if (srd.Name == "Column")
{
richTextBox1.Text += "Column Name: " + srd.GetAttribute("name") + "\n";
richTextBox1.Text += "Column Type: " + srd.GetAttribute("type") + "\n";
}
}
-----------------------------------------------------------------
|
|
|
|
|
Hi All
I am developing the Search Engine that is working properly and returning the path of files(store in directory at server ) . Now i want to display FileName as url and whenever userclick that url the Document/file should be open in new window .
Which control should i use for hyperlink ?
HyperLink, LinkButton or simple tag
Can any one tell me how to open a document in different window ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
You can use <asp:HyperLink> and set its Target property to "_blank" and its NavigateUrl property to the file url and done!!!!!!!!!!!!!!!!!.
I hope this will help you.
-- modified at 6:56 Friday 8th June, 2007
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Chetan Ranpariya wrote: Target property to "_blank" and its NavigateUrl property
Are you suggesting HyperLink Control ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
You r right. I m suggesting you to use hyperlink control.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Add the target="_blank" attribute to the link.
|
|
|
|
|
Are you trying to do this after a postback or from a regular link?
Regular link:
<a href="http://www.codeproject.com" target="codeProjectWindow">The Code Project</a>
Code Behind:
You'll need to register a client startup script to open the new window once the page has loaded:
<code>
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Page.ClientScript.RegisterStartupScript(Me.GetType, "codeProjectRedirect", "window.open('http://www.codeproject.com')", True)
End Sub
<code>
Hope this helps
Tom
-- modified at 13:41 Friday 8th June, 2007
|
|
|
|
|
Tom John wrote: client startup script to open the new window once the page has loaded:
How will it open if have only path of directory such as C://Albums/FilaName.txt
store at the server side Its not a website page
i think its bit clear now
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Sandeep Akhare wrote: How will it open if have only path of directory such as C://Albums/FilaName.txt
store at the server side Its not a website page
It depends on the MIME type man... Text files normally open directly into the IE.
|
|
|
|
|
Yes but the problem is that the its a web application and client will not be able to open a file untill it is in Virtual directory or it is in current application folder ..........
Link having url of any file in server will not open in this way
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
im using asp.net 2.0+c#
i have a datalist1 as a itemtemplate in a datalist2.
in datalist2 i have an itemtemplate button if i click on that i have to bind the datalist1.hw can i do that dyanmically??
|
|
|
|
|
Hi,
Create an event handler for handling ItemCommand event of datalist as following.
protected void dlst_ItemCommand ( object source, DataListCommandEventArgs e )
{
//Find InnerDatalit.
DataList datalist1 = ( DataList )e.Item.FindControl( "DataList1" );
//Set its datasource
datalist1.DataSource = datasource.
//Bind it.
datalist1.DataBind();
}
This event will call when u click on button in the outer datalist and will find inner datalist and bind it to the data.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Thanks its working
|
|
|
|
|
I am creating a custom WebControl. I noticed that it wraps everything in a SPAN tag. How can I get rid of this tag? I don’t want it to appear!
|
|
|
|
|
Override the constructor of the web control and pass in a string representing the tag you want it to be rendered as:
<br />
<DefaultProperty("Text"), ToolboxData("<{0}:TestControl runat=server></{0}:TestControl>")> _<br />
<PartialCaching(10, Nothing, Nothing, "CustomTest")> _<br />
Public Class TestControl<br />
Inherits WebControl<br />
<br />
Public Sub New()<br />
MyBase.New("div")<br />
<br />
End Sub<br />
<br />
Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter)<br />
writer.Write("Time Now: " & Date.Now)<br />
End Sub<br />
<br />
End Class<br />
Hope this helps
Tom
|
|
|
|
|
Yes, this allows me to change the tag. But I dont want it changed. I want it completely removed.
|
|
|
|
|
Override the RenderBeginTag and RenderEndTag and just don't call the base method:
<br />
Public Class TestControl<br />
Inherits WebControl<br />
<br />
Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter)<br />
writer.Write("Time Now: " & Date.Now)<br />
End Sub<br />
<br />
Public Overrides Sub RenderBeginTag(ByVal writer As System.Web.UI.HtmlTextWriter)<br />
'MyBase.RenderBeginTag(writer)<br />
End Sub<br />
<br />
Public Overrides Sub RenderEndTag(ByVal writer As System.Web.UI.HtmlTextWriter)<br />
'MyBase.RenderEndTag(writer)<br />
End Sub<br />
<br />
<br />
End Class<br />
Hope this helps
Tom
|
|
|
|