Saturday, March 24, 2012
TabStrip code in VB.NET
I've tried to find a way to connect .aspx pages to a TabStrip webctrl but I've only found code with embedded <table><tr> stuff.
Can anyone help me finding some useful code?
TIA
/Kennethtake a look at the tabstrip control at www.asp.net, comes with the
sourcecode
--
Regards
John Timney (Microsoft ASP.NET MVP)
--------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
--------------
"Kenneth" <anonymous@.discussions.microsoft.com> wrote in message
news:4A56DAA1-7BF9-4396-94DD-D28F86D644F8@.microsoft.com...
> Hi,
> I've tried to find a way to connect .aspx pages to a TabStrip webctrl but
I've only found code with embedded <table><tr> stuff.
> Can anyone help me finding some useful code?
> TIA
> /Kenneth
John,
This is exactly what I mean. in www.asp.net they're referring to the ie web ctrls and tabstrip can't handle urlnavigation to existing .aspx documents.
The IEWebCtrls are NOT the correct answer.
/Kenneth
well you can set IE controls... TabStrip exactly to do a postback... in the
postback you can check for the SelectedIndex and post it to whatever aspx
name you need to.
its not the most elegant way but it sure does the job.
private void tsNav_SelectedIndexChange(object sender, System.EventArgs e)
{
SetNav();
}
private void SetNav()
{
switch(tsNav.SelectedIndex)
{
case 0:
myLoader.Attributes.Add("src", "CA_ShowEarlyBird.aspx");
break;
case 1:
myLoader.Attributes.Add("src", "CA_ShowCategories.aspx");
break;
case 2:
myLoader.Attributes.Add("src", "CA_ShowSubCategories.aspx");
break;
case 3:
myLoader.Attributes.Add("src", "CA_ShowAvailableColors.aspx");
break;
case 4:
myLoader.Attributes.Add("src", "CA_ShowAvailableSizes.aspx");
break;
case 5:
myLoader.Attributes.Add("src", "CA_ShowProducts.aspx");
break;
case 6:
Response.Redirect("~/Signout.aspx");
break;
}
}
and it sure does work...
--
Regards,
HD
Once a Geek... Always a Geek
"Kenneth" <anonymous@.discussions.microsoft.com> wrote in message
news:3A86E31B-3662-4D24-8F95-14A7676DA18D@.microsoft.com...
> John,
> This is exactly what I mean. in www.asp.net they're referring to the ie
> web ctrls and tabstrip can't handle urlnavigation to existing .aspx
> documents.
> The IEWebCtrls are NOT the correct answer.
> /Kenneth
tabstrip control
Could anyone give me an example of how to do this?
TIAI don't know if you are looking for something like that howevertake a look here
Tabstrip like behavior of Menu
I want the menu to behave like a tabstrip so I am trying NavigateURL along with Target property of the MenuItem Collection.
What I want is, when the user clicks on a "Tab", that tab should become active. How would I do that?Maybe you can use the DynamicSelectedStyle or StaticSelectedStyle property of the Menu control to change the style of the selected item
I don't want to launch another window. I can do a Target=_self to launch it in the same window but the problem with that is I loose the menu. Maybe I can define nested Master Page so that the menu is retained across pages.
Is there any other (easier) way to implement this?
tabstrip webcontrol can not work in framework 1.1
Hi all,
I've encountered a problem when opening an aspx page with a tabstrip
webcontrol on a windows 2003 server. (.net framework version 1.1).
I created the tabstrip in Windows 2000 and framework version was 1.0.3075. R
ight now it does not supported by the new version of framework. (1.1)
How should I do?
Thanks a lot!
From: Linda wu
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>4BBS4PQmuUyyL+NI63s7Lw==</Id>Hi Linda,
Since you can get the source code for the tabstrip, you may be able to
recompile it for 1.1:
http://www.asp.net/IEWebControls/Do...index=0&tabid=1
"Linda wu via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:%23YPmJfVMEHA.2556@.TK2MSFTNGP10.phx.gbl...
tabstrip webcontrol can not work in framework 1.1
Hi all,
I've encountered a problem when opening an aspx page with a tabstrip
webcontrol on a windows 2003 server. (.net framework version 1.1).
I created the tabstrip in windows 2000 and framework version was 1.0.3075. Right now it does not supported by the new version of framework. (1.1)
How should I do?
Thanks a lot!
----------
From: Linda wu
--------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>4BBS4PQmuUyyL+NI63s7Lw==</Id>Hi Linda,
Since you can get the source code for the tabstrip, you may be able to
recompile it for 1.1:
http://www.asp.net/IEWebControls/Do...index=0&tabid=1
"Linda wu via .NET 247" <anonymous@.dotnet247.com> wrote in message
news:%23YPmJfVMEHA.2556@.TK2MSFTNGP10.phx.gbl...
Tabview control focus problem
Hi,
I have a yahoo tabview control with 3 tabs in my aspx page. If I am in the third tab and a control fires a postback, then I need the page to load with the third tab in focus. Instead it is showing the default first tab.
Any help is appreciated.
Thanks.
Hello,
Because we don't know how to code the third-party control, you may find some codes like this:
<script type="text/javascript">
var myTabs = new YAHOO.widget.TabView('demo', { activeIndex: 1 } ); // make tab at position 1 active
alert(myTabs.get('activeIndex')); // alerts 1
myTabs.set('activeIndex', 0); // make tab at index 0 active
alert(myTabs.get('activeIndex')); // alerts 0
</script>
Or
<li class="selected"><a href="#tab1"><em>Tab One Label</em></a></li>
As shown above, the red lines you see may help you, just change the index number you want.
There are more references for you:
A Simple TabView for Web Pages
http://www.codeproject.com/asp/TabView.asp
HTH
Hi could you let me know how to create tab forms in ASP.NET 2.0 without using any thirdparty tools...Thanks
TagPrefix is not recognized
I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :
Now when I use this webpart DLL as a reference in website project and
include this line
<%@dotnet.itags.org. Register TagPrefix="custom" Namespace="aspwebpart" %>
The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>
<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>
Any Ideas??
================================================== =========
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
namespace aspwebpart
{
public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Datab ase=NorthWind";
const string query = "Select * from products";
public FeaturePart()
{
this.Title = "Feature Part";
}
protected override void RenderContents(HtmlTextWriter writer)
{
DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];
writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));
base.RenderContents(writer);
}
}
}
Regards
MadhurMadhur,
Check out my post "Error creating control..Server tag error" from earlier in
the day. I had this error with a custom control. Don't know if the same
applies to webparts but you may need to add the "assembly=" attribute. See
my sample code and resolution in the posts. Dave
"ahuja.madhur@.gmail.com" wrote:
Quote:
Originally Posted by
Hello
>
I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :
>
Now when I use this webpart DLL as a reference in website project and
include this line
>
<%@. Register TagPrefix="custom" Namespace="aspwebpart" %>
>
The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>
>
<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>
>
Any Ideas??
>
================================================== =========
>
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
>
namespace aspwebpart
{
>
public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Datab ase=NorthWind";
const string query = "Select * from products";
>
public FeaturePart()
{
this.Title = "Feature Part";
}
>
protected override void RenderContents(HtmlTextWriter writer)
{
>
DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];
>
writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));
>
base.RenderContents(writer);
}
>
}
}
>
Regards
>
Madhur
>
>
Hi Dave
Gr8 !!! That did the trick. Thanks very much
Clear me one thing, what does Assembly attribute refers to?
Does it refer dll file name or Assembly is an attribute stored inside
..NET metadata.
I am asking it because when I appended .dll in front of it, it again
gave the same error.
Madhur
Dave wrote:
Quote:
Originally Posted by
Madhur,
>
Check out my post "Error creating control..Server tag error" from earlier in
the day. I had this error with a custom control. Don't know if the same
applies to webparts but you may need to add the "assembly=" attribute. See
my sample code and resolution in the posts. Dave
>
"ahuja.madhur@.gmail.com" wrote:
>
Quote:
Originally Posted by
Hello
I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :
Now when I use this webpart DLL as a reference in website project and
include this line
<%@. Register TagPrefix="custom" Namespace="aspwebpart" %>
The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>
<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>
Any Ideas??
================================================== =========
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
namespace aspwebpart
{
public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Datab ase=NorthWind";
const string query = "Select * from products";
public FeaturePart()
{
this.Title = "Feature Part";
}
protected override void RenderContents(HtmlTextWriter writer)
{
DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];
writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));
base.RenderContents(writer);
}
}
}
Regards
Madhur
Madhur,
The assembly name refers to the project that contains my custom controls.
In my case my project name was CustomControls, so when I compile it becomes
CustomControls.dll. The assembly attribute must then match the name of the
dll..."Assembly="CustomControls" without the .dll extension though..go figure.
"ahuja.madhur@.gmail.com" wrote:
Quote:
Originally Posted by
Hi Dave
>
Gr8 !!! That did the trick. Thanks very much
Clear me one thing, what does Assembly attribute refers to?
Does it refer dll file name or Assembly is an attribute stored inside
..NET metadata.
>
I am asking it because when I appended .dll in front of it, it again
gave the same error.
>
Madhur
>
>
Dave wrote:
>
Quote:
Originally Posted by
Madhur,
Check out my post "Error creating control..Server tag error" from earlier in
the day. I had this error with a custom control. Don't know if the same
applies to webparts but you may need to add the "assembly=" attribute. See
my sample code and resolution in the posts. Dave
"ahuja.madhur@.gmail.com" wrote:
Quote:
Originally Posted by
Hello
>
I am creating a ASP.net 2.0 webpart for use in an aspx just for
learning purpose.
My webpart code is very simple :
>
Now when I use this webpart DLL as a reference in website project and
include this line
>
<%@. Register TagPrefix="custom" Namespace="aspwebpart" %>
>
The custom keywork is not usable inside the aspx page.
These lines throw the error that FeaturePart is not recognized
<WebPartsTemplate>
>
<custom:FeaturePart ID="my" Runat="Server" />
</WebPartsTemplate>
>
Any Ideas??
>
================================================== =========
>
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
>
namespace aspwebpart
{
>
public class FeaturePart:WebPart
{
const string str =
"server=10.111.121.24;Trusted_Connection=true;Datab ase=NorthWind";
const string query = "Select * from products";
>
public FeaturePart()
{
this.Title = "Feature Part";
}
>
protected override void RenderContents(HtmlTextWriter writer)
{
>
DataTable pt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(query, str);
da.Fill(pt);
Random rnd = new Random();
DataRow row = pt.Rows[rnd.Next(pt.Rows.Count)];
>
writer.Write((string)row["ProductName"]);
writer.Write(string.Format("-{0:c}", row["UnitPrice"]));
>
base.RenderContents(writer);
}
>
}
}
>
Regards
>
Madhur
>
>
>
>
Thursday, March 22, 2012
TagPrefix Defined Globally...?
I have the following register tag for my custom controls on each of my ASPX pages:
Is it possible to make this decleartion globally, say in global.asa or web.config?
<%@dotnet.itags.org. Register TagPrefix="MY" Namespace="MY.Presentation" Assembly="MY.Presentation"%>
Or is it required that each page defines it individually?
Has anyone come across an elgeant solution for doing this? I'm using <!-- Include --> at the moment but surely theres a way of avoiding this?
Any help would be very much appreciated.
Thanks in advance.
SarahThere is no other solution at the moment -- this will be addressed in v2.0 (Whidbey).
tags not being displayed in form
Cheers
JamieHello, all what you need is to copy your aspx files, all other folder, bin folder and place them in the main root directory of your webspace.
You can use simlpe FTP for sure, or any other procedure that is offered by the hosting company.
regards.
The aspx files are in the root directory already. We have our own intranet server here so we do the development locally. This has me well stuck. Have you got any other possible cures I am gettin bit desperate.
Post code so we can try to repro locally.
Hello, what is exactly the errors you are getting ? You asked how to move the files to a real server, and we gave the solution, what is exactly the problem now ? Explain more to be able to help you.
regards.
Take into a varible the HTML of a aspx page
You can use Response.Filter to do this. Here's an example:
using System;
using System.IO;
namespace cslocation
{
/// <summary>
/// Summary description for MyFilter.
/// </summary>
public class HTMLFilter : Stream
// This filter changes all characters passed through it to uppercase.
{
private Stream _sink;
private long _position;
public byte[] data;
public EmailFilter(Stream sink)
{
_sink = sink;
}
// The following members of Stream must be overriden.
public override bool CanRead
{
get { return true; }
}
public override bool CanSeek
{
get { return true; }
}
public override bool CanWrite
{
get { return true; }
}
public override long Length
{
get { return 0; }
}
public override long Position
{
get { return _position; }
set { _position = value; }
}
public override long Seek(long offset, System.IO.SeekOrigin direction)
{
return _sink.Seek(offset, direction);
}
public override void SetLength(long length)
{
_sink.SetLength(length);
}
public override void Close()
{
_sink.Close();
}
public override void Flush()
{
_sink.Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
return _sink.Read(buffer, offset, count);
}
// The Write method actually does the filtering.
public override void Write(byte[] buffer, int offset, int count)
{
data = new byte[count];
Buffer.BlockCopy(buffer, offset, data, 0, count);
_sink.Write (data, 0, count);
}
}
}
You can then instantiate this class as follows:
Response.Filter = new HTMLFilter(Response.Filter);
Hope that helps.
Jim Cheshire [MSFT]
Developer Support
ASP.NET
jamesche@dotnet.itags.org.online.microsoft.com
This post is provided as-is with no warranties and confers no rights.
-------
>Content-Class: urn:content-classes:message
>From: "jacas" <anonymous@dotnet.itags.org.discussions.microsoft.com>
>Sender: "jacas" <anonymous@dotnet.itags.org.discussions.microsoft.com>
>Subject: Take into a varible the HTML of a aspx page
>Date: Thu, 23 Oct 2003 09:00:01 -0700
>Lines: 7
>Message-ID: <00db01c3997e$b6ed2630$a301280a@dotnet.itags.org.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcOZfrbt/w7LUNvpQrmKlBXOan6XQg==
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186086
>NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Somebody can expli-me how to take de the HTML of a aspx
>page into a string variable may be in de render or
>prerender event of a page
>
>thanksHy Jim,
I don't know if I don't understand but whith your code you
do a filter of the response but what I want is to take the
HTML an put it in a string varible... I do it from another
page like
you can get HtML froma a page like
mywebReq = WebRequest.Create("http://www.c-
sharpcorner.com/faq.asp")
mywebResp = mywebReq.GetResponse()
sr = New StreamReader(mywebResp.GetResponseStream,
System.Text.Encoding.ASCII)
strHTML = sr.ReadToEnd
TextBox1.Text = strHTML
but it has problems when the page is in de same directory
as de page in where de code is an in it you have to
athentificate if you want to wiev pages, but i thing it
might be a way of take that page if you are already
athentificate
i proof that
mywebReq = WebRequest.Create(site & "(" &
Request.ServerVariables("HTTP_ASPFILTERSESSIONID") & ")
page.aspx")
but d'ont works
and I thinkg there is a way for do that in the same page
that I want the HTML ...what i want is to take the
Response.content in a string variable like
str = Response.content (this is not possible but is for
expline what i want)
Thanks any way
Jacas,
I'm having a little trouble understanding exactly what you're saying, but
if I understand correctly, you want to get the HTML that is rendered by
ASP.NET and store it in a variable. If that's the case, Response.Filter is
the way to go and using the code I posted is what you want to use.
That code was originally written by one of my colleagues for a customer we
were working with who wanted to do the exact same thing you're doing. The
only difference is that our other customer was taking that HTML and
populating an e-mail message with it. You just want to store it. The end
result is the same. If you want to do it reliably, use Response.Filter.
Jim Cheshire [MSFT]
Developer Support
ASP.NET
jamesche@.online.microsoft.com
This post is provided as-is with no warranties and confers no rights.
-------
>Content-Class: urn:content-classes:message
>From: "jacas" <anonymous@.discussions.microsoft.com>
>Sender: "jacas" <anonymous@.discussions.microsoft.com>
>References: <00db01c3997e$b6ed2630$a301280a@.phx.gbl>
<SDvxA3YmDHA.1544@.cpmsftngxa06.phx.gbl>
>Subject: RE: Take into a varible the HTML of a aspx page
>Date: Fri, 24 Oct 2003 01:48:25 -0700
>Lines: 38
>Message-ID: <0ae701c39a0b$9627e2e0$a101280a@.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcOaC5Yls6pRYc1aRouN+9Tsp3ecsA==
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186270
>NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>Hy Jim,
>I don't know if I don't understand but whith your code you
>do a filter of the response but what I want is to take the
>HTML an put it in a string varible... I do it from another
>page like
>you can get HtML froma a page like
> mywebReq = WebRequest.Create("http://www.c-
>sharpcorner.com/faq.asp")
> mywebResp = mywebReq.GetResponse()
> sr = New StreamReader(mywebResp.GetResponseStream,
>System.Text.Encoding.ASCII)
> strHTML = sr.ReadToEnd
> TextBox1.Text = strHTML
>but it has problems when the page is in de same directory
>as de page in where de code is an in it you have to
>athentificate if you want to wiev pages, but i thing it
>might be a way of take that page if you are already
>athentificate
>i proof that
>mywebReq = WebRequest.Create(site & "(" &
>Request.ServerVariables("HTTP_ASPFILTERSESSIONID") & ")
>page.aspx")
>but d'ont works
>and I thinkg there is a way for do that in the same page
>that I want the HTML ...what i want is to take the
>Response.content in a string variable like
>str = Response.content (this is not possible but is for
>expline what i want)
>Thanks any way
I work with VB an i translate your code
Public Class HTMLFilter
Inherits Stream
Private _sink As Stream
Private _position As Long
Public data As Byte()
Public Sub EmailFilter(ByVal sink As Stream)
_sink = sink
End Sub
Overrides ReadOnly Property CanRead() As Boolean
Get
Return True
End Get
End Property
Overrides ReadOnly Property CanSeek() As Boolean
Get
Return True
End Get
End Property
Overrides ReadOnly Property CanWrite() As Boolean
Get
Return True
End Get
End Property
Overrides ReadOnly Property Length() As Long
Get
Return 0
End Get
End Property
Overrides Property Position() As Long
Get
Return _position
End Get
Set(ByVal Value As Long)
_position = Value
End Set
End Property
Public Overrides Function Seek(ByVal offset As
Long, ByVal direction As SeekOrigin) As Long
Return _sink.Seek(offset, direction)
End Function
Public Overrides Sub SetLength(ByVal length As
Long)
_sink.SetLength(length)
End Sub
Public Overrides Sub Close()
_sink.Close()
End Sub
Public Overrides Sub Flush()
_sink.Flush()
End Sub
Public Overloads Function Read(ByVal buffer() As
Byte, ByVal offset As Int16, ByVal count As Int16) As Int16
Return _sink.Read(buffer, offset, count)
End Function
Public Overloads Function Write(ByVal buffer() As
Byte, ByVal offset As Int16, ByVal count As Int16)
ReDim data(count)
System.Buffer.BlockCopy(buffer, offset, data,
0, count)
_sink.Write(data, 0, count)
End Function
End Class
but intelligence says to me that the class HTMLFilter must
either be declared 'MustInherit' or override the following
inherited 'MustOverride' members: Public Overridable
MustOverride Overloads Sub Write(buffer() As Byte, offset
As Integer, count As Integer), Public Overridable
MustOverride Overloads Function Read(buffer() As Byte,
offset As Integer, count As Integer) As Integer
but if I understand i do it... please if you can help me...
and if i understand the page is in de accesible punblic
data that is a byte() , sorry if it is very simple but how
i take it in a varible string , you say to instantiate the
class
Response.Filter= new HTMLFilter(Response.filter)
but how i can take the HTML in string (sorry because is
posible that i don't be a very good student) ;-)
Xavi
Xavi,
I can provide you with the sample, but if you need assistance in reworking
it for your application, you would need to open a case with us. That kind
of work goes beyond what we can do in the newsgroups.
Jim Cheshire [MSFT]
Developer Support
ASP.NET
jamesche@.online.microsoft.com
This post is provided as-is with no warranties and confers no rights.
-------
>Content-Class: urn:content-classes:message
>From: <anonymous@.discussions.microsoft.com>
>Sender: <anonymous@.discussions.microsoft.com>
>References: <00db01c3997e$b6ed2630$a301280a@.phx.gbl>
<SDvxA3YmDHA.1544@.cpmsftngxa06.phx.gbl>
<0ae701c39a0b$9627e2e0$a101280a@.phx.gbl>
<VFH0lAkmDHA.1772@.cpmsftngxa06.phx.gbl>
>Subject: RE: Take into a varible the HTML of a aspx page
>Date: Mon, 27 Oct 2003 10:52:48 -0800
>Lines: 89
>Message-ID: <026201c39cbb$83f450b0$a301280a@.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
>charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Thread-Index: AcOcu4P0bnCG4ILqTTeyjwHdVOkP5A==
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:186784
>NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>I work with VB an i translate your code
>Public Class HTMLFilter
> Inherits Stream
> Private _sink As Stream
> Private _position As Long
> Public data As Byte()
> Public Sub EmailFilter(ByVal sink As Stream)
> _sink = sink
> End Sub
> Overrides ReadOnly Property CanRead() As Boolean
> Get
> Return True
> End Get
> End Property
> Overrides ReadOnly Property CanSeek() As Boolean
> Get
> Return True
> End Get
> End Property
> Overrides ReadOnly Property CanWrite() As Boolean
> Get
> Return True
> End Get
> End Property
> Overrides ReadOnly Property Length() As Long
> Get
> Return 0
> End Get
> End Property
> Overrides Property Position() As Long
> Get
> Return _position
> End Get
> Set(ByVal Value As Long)
> _position = Value
> End Set
> End Property
> Public Overrides Function Seek(ByVal offset As
>Long, ByVal direction As SeekOrigin) As Long
> Return _sink.Seek(offset, direction)
> End Function
> Public Overrides Sub SetLength(ByVal length As
>Long)
> _sink.SetLength(length)
> End Sub
> Public Overrides Sub Close()
> _sink.Close()
> End Sub
> Public Overrides Sub Flush()
> _sink.Flush()
> End Sub
> Public Overloads Function Read(ByVal buffer() As
>Byte, ByVal offset As Int16, ByVal count As Int16) As Int16
> Return _sink.Read(buffer, offset, count)
> End Function
> Public Overloads Function Write(ByVal buffer() As
>Byte, ByVal offset As Int16, ByVal count As Int16)
> ReDim data(count)
> System.Buffer.BlockCopy(buffer, offset, data,
>0, count)
> _sink.Write(data, 0, count)
> End Function
> End Class
>but intelligence says to me that the class HTMLFilter must
>either be declared 'MustInherit' or override the following
>inherited 'MustOverride' members: Public Overridable
>MustOverride Overloads Sub Write(buffer() As Byte, offset
>As Integer, count As Integer), Public Overridable
>MustOverride Overloads Function Read(buffer() As Byte,
>offset As Integer, count As Integer) As Integer
>but if I understand i do it... please if you can help me...
>and if i understand the page is in de accesible punblic
>data that is a byte() , sorry if it is very simple but how
>i take it in a varible string , you say to instantiate the
>class
>Response.Filter= new HTMLFilter(Response.filter)
>but how i can take the HTML in string (sorry because is
>posible that i don't be a very good student) ;-)
>Xavi
Take labels name ??
hi everyone !
I really need make that function work !
im brazilian , and i want to make a multilanguage system ,
that function above must look at all ASPX take the labels
ID and send as a parameter
,... so Please , help me ,.. cause it doest work !
'------------------
-----
' LOAD PAGE
'------------------
-----
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load
TraduzLbl(me)
end sub
Sub TraduzLbl(byval parent As Control)
Dim XmlLang1 as new XmlLang
Dim varxml as string
Dim c As Control
For each c In parent.Controls
If c.GetType() is GetType(system.web.ui.webcontrols.Label)
Then
varxml = CType(c,system.web.ui.webcontrols.Label).text
CType(c,system.web.ui.webcontrols.Label).text =
XmlLang1.GetString(varxml)
End If
Next
End SubI do something very similar with all labels on a page (though I only use c#
so the vb code is difficult for me to follow!). May I ask what actually
happens when you run this ? My first thought is that you must make the
routine recursive by calling itself on each sub-control within each top
level control on the page.
"Giovane Calabrese" <giovanectba@.brturbo.com> wrote in message
news:080e01c3c09f$55df5aa0$a401280a@.phx.gbl...
> ( aspx + vb )
> hi everyone !
> I really need make that function work !
> im brazilian , and i want to make a multilanguage system ,
> that function above must look at all ASPX take the labels
> ID and send as a parameter
> ,... so Please , help me ,.. cause it doest work !
> '------------------
> -----
> ' LOAD PAGE
> '------------------
> -----
> Private Sub Page_Load(ByVal sender As System.Object, ByVal
> e As System.EventArgs) Handles MyBase.Load
> TraduzLbl(me)
> end sub
> Sub TraduzLbl(byval parent As Control)
> Dim XmlLang1 as new XmlLang
> Dim varxml as string
> Dim c As Control
> For each c In parent.Controls
> If c.GetType() is GetType(system.web.ui.webcontrols.Label)
> Then
> varxml = CType(c,system.web.ui.webcontrols.Label).text
> CType(c,system.web.ui.webcontrols.Label).text =
> XmlLang1.GetString(varxml)
> End If
> Next
> End Sub
ok. im try to make a multilanguage system based on that
tutorial :
http://www.123aspx.com/redir.aspx?res=29112
in my aspx pages all text are in labels , and i want to
take the name labels ( in one loop ) and for each label
take on the XML document the right(in the right language)
Value (text).
Above you can see what im doing , it works , however im
trying to make a function that look at all aspx and when
found a LABEL , take the value ( text) from one xml
document like the function in the end of this document.
************************************************** ********
I have created an object that will retrieve the correct
data from an XML file. The code in C# is displayed below.
----------------
using System;
using System.Xml;
namespace diffudessnet
{
public class XmlLang
{
protected XmlDataDocument X;
protected String Lang;
public XmlLang(String FileName,String
Language)
{
String Name
= "http://localhost/myapp/xml/"+ FileName;
X = new XmlDataDocument();
X.Load(Name);
Lang = Language;
}
public XmlLang(String FileName)
{
String Name
= "http://localhost/myapp/xml/"+ FileName;
X = new XmlDataDocument();
X.Load(Name);
Lang = "N";
}
public String GetString(String Name)
{
XmlNode node;
node = X.SelectSingleNode
("//main/language[@.id='" +Lang + "']/" + Name);
if (node == null) return "";
else
{
string value =
node.InnerXml.ToString();
return value;
}
}
}
}
----------------
This object has three methods:
XmlLang::XmlLang(String FileName, String Language)
XmlLang::XmlLang(String FileName)
String XmlLang::GetString(String Name)
To start, we will assume all XML documents are in the same
directory. In this way, they can be made inaccessible to
all users. The path of this directory is hardcoded in the
source of the object. A good alternative is using the
ConfigurationSettings.AppSettings method and saving all
values in the web.config file.
In the first version of the constructor, the name of the
XML file and the selected language are passed to the
constructor. If you want to select a name for the
document, it might be useful to select the same name as
you aspx file. The language parameter is a simple string.
Possible values are "N" for Dutch, "F" for French, "E" for
English, . The format of the XML document will be
discussed later.
The second version of the constructor will automatically
select the Dutch version of the texts. This option is very
handy if you only want to use the Dutch version, and other
languages are only planned for the future.
The method GetString(String Name) will retrieve the text
belonging to the node named Name from the XML file. All
text items in the XML document are marked by keywords. The
value of a keyword is the word in the specified language.
--------------
XML Document
<?xmlversion="1.0"encoding="utf-8"?>
<main>
< language id ="N">
<name>Naam</ name>
<number>Nummer</number>
<street>Straat</street>
<country>Land</country>
</ language >
< language id ="E">
<name>Name</name>
<number>Number</number>
<street>Street</street>
<country>Country</country>
</language>
<languageid="F">
<name>Nom</name>
<number>Nummro</number>
<street>Rue</street>
<country>Pays</country>
</language>
</main>
Different languages are separated by the <language
id="languageid" /> tags. The languageid attribute should
be passed to the constructor of the class.
Using the class
Using the object is pretty straightforward. You create a
new instance of the object in the OnInit(.) member
function of your page object. Suppose we have a page
called client.aspx containing client data. The name of the
codebehind file is client.aspx.cs. To make things simple,
we name the xml file client.xml.
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
XmlLang Lang = new XmlLang("client.xml",Session
["LANGUAGE"].ToString());
this.NameLabel.Text = Lang.GetString("name");
this.StreetLabel.Text = Lang.GetString("street");
this.CountryLabel.Text = Lang.GetString("country");
}
Instead of hard-coding all static text in client.aspx, we
use labels as a replacement. In the OnInit member
function, these labels are filled with the right contents,
depending on the selected language. In this example, the
chosen language is stored in a session variable : Session
["LANGUAGE"]. The method as it is mentioned also allows
you to change column headers from a datagrid object.
************************************************** ********
>--Original Message--
>I do something very similar with all labels on a page
(though I only use c#
>so the vb code is difficult for me to follow!). May I ask
what actually
>happens when you run this ? My first thought is that you
must make the
>routine recursive by calling itself on each sub-control
within each top
>level control on the page.
>"Giovane Calabrese" <giovanectba@.brturbo.com> wrote in
message
>news:080e01c3c09f$55df5aa0$a401280a@.phx.gbl...
>> ( aspx + vb )
>> hi everyone !
>> I really need make that function work !
>> im brazilian , and i want to make a multilanguage
system ,
>> that function above must look at all ASPX take the
labels
>> ID and send as a parameter
>> ,... so Please , help me ,.. cause it doest work !
>>
>> '-----------------
--
>> -----
>> ' LOAD PAGE
>> '-----------------
--
>> -----
>> Private Sub Page_Load(ByVal sender As System.Object,
ByVal
>> e As System.EventArgs) Handles MyBase.Load
>> TraduzLbl(me)
>>
>> end sub
>>
>> Sub TraduzLbl(byval parent As Control)
>> Dim XmlLang1 as new XmlLang
>> Dim varxml as string
>> Dim c As Control
>>
>> For each c In parent.Controls
>> If c.GetType() is GetType
(system.web.ui.webcontrols.Label)
>> Then
>> varxml = CType(c,system.web.ui.webcontrols.Label).text
>> CType(c,system.web.ui.webcontrols.Label).text =
>> XmlLang1.GetString(varxml)
>>
>> End If
>>
>> Next
>> End Sub
>
>.
Taking your database driven aspx website online.
Thanx
you need a hoster that supports Asp.Net AND SQL Server.
they will have specifics on how to connect to the the SQL server
You will upload all the .aspx files ( and the directories ) and then upload your .dll's to the "bin" directory
you need to tell some hosters that you are running a .Net site so that they can make your directory an application
HTH
Hello,
What you need now is to find a host then to deploy your application. Let me help you in that
1) one you have hoster, you can access your site using FTP
2) After login to FTP upload your aspx pages to wwwroot of the server
3) Upload the /bin folder to the server also to be like that wwwroot/bin
4) You should access the MSSQL and create database in a control panelthat the hoster will give you the information on how to log in and use
Finally, if u need a great host, i can recommendserverdivision.com, they are oen of the best in .NET technology
HTH
regards
Tuesday, March 13, 2012
Target for aspx page
other pages. I want my aspx page to always display in a new browser window.
Since the Response.Redirect calls from the other pages can't inoke _blank as
a target value, is there any way I can ensure that my aspx page always
displays in a new browser window?
Thanks,
Tinawhy not use javascript instead?
Saber S.
http://maghalat.com (Persian)
"T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
>I have an aspx page that is always invoked by Response.Redirect calls from
> other pages. I want my aspx page to always display in a new browser
> window.
> Since the Response.Redirect calls from the other pages can't inoke _blank
> as
> a target value, is there any way I can ensure that my aspx page always
> displays in a new browser window?
> Thanks,
> Tina
>
It's currently a rule here not to use any javascript. as least we use it as
a last resort.
T
"Saber" <saber[-.-AT.--]maghalat.com> wrote in message
news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> why not use javascript instead?
>
> --
> Saber S.
> http://maghalat.com (Persian)
> "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
from
_blank
>
You can't open a new window from the server. It's a client-side task that
can be accomplished only with a client-side script.
I am just wondering how many successful asp.net sites has the person who
wrote your rules made?
Eliyahu
"T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
> It's currently a rule here not to use any javascript. as least we use it
as
> a last resort.
> T
> "Saber" <saber[-.-AT.--]maghalat.com> wrote in message
> news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> from
> _blank
>
That's not true. take an ordinary Hyperlink on any aspx page that links to
another aspx page. set it's target property to _blank and the new aspx page
will pop up in a new browser window. No client script was involved. I'm
just trying to do the same thing from a respnse.redirect that we all often
do from hyperlinks.
T
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:Ov7BNzZjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> You can't open a new window from the server. It's a client-side task that
> can be accomplished only with a client-side script.
> I am just wondering how many successful asp.net sites has the person who
> wrote your rules made?
> Eliyahu
> "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
it
> as
always
>
Admitting the mistake in the first statement, thank you, I am still
insisting that you can't make anything more-or-less meaningful in ASP.NET
without good deal of javascripting.
Eliyahu
"GaryB" <gb@.nospam.com> wrote in message
news:O$SZIO7jEHA.3456@.TK2MSFTNGP12.phx.gbl...
> That's not true. take an ordinary Hyperlink on any aspx page that links
to
> another aspx page. set it's target property to _blank and the new aspx
page
> will pop up in a new browser window. No client script was involved. I'm
> just trying to do the same thing from a respnse.redirect that we all often
> do from hyperlinks.
> T
>
> "Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
> news:Ov7BNzZjEHA.3696@.TK2MSFTNGP15.phx.gbl...
that
> it
calls
browser
> always
>
a rule not to use javascript - I am very curious as to why ... and who made
the tech choice to go with .NET? obviously they had a great handle on the
workings of the framework ...
"T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
> It's currently a rule here not to use any javascript. as least we use it
> as
> a last resort.
> T
> "Saber" <saber[-.-AT.--]maghalat.com> wrote in message
> news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> from
> _blank
>
If I understand your question correctly hopefully this will do what you are
wanting
Response.Write("<script
type='text/javascript'>detailedresults=window.open('...Your New Page
Here...');</script>")
Just replace ...Your New Page Here... and it should launch a new window for
you.
William Higgins
"T. Seaburn" wrote:
> I have an aspx page that is always invoked by Response.Redirect calls from
> other pages. I want my aspx page to always display in a new browser windo
w.
> Since the Response.Redirect calls from the other pages can't inoke _blank
as
> a target value, is there any way I can ensure that my aspx page always
> displays in a new browser window?
> Thanks,
> Tina
>
>
Target for aspx page
other pages. I want my aspx page to always display in a new browser window.
Since the Response.Redirect calls from the other pages can't inoke _blank as
a target value, is there any way I can ensure that my aspx page always
displays in a new browser window?
Thanks,
Tinawhy not use javascript instead?
--
Saber S.
http://maghalat.com (Persian)
"T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
>I have an aspx page that is always invoked by Response.Redirect calls from
> other pages. I want my aspx page to always display in a new browser
> window.
> Since the Response.Redirect calls from the other pages can't inoke _blank
> as
> a target value, is there any way I can ensure that my aspx page always
> displays in a new browser window?
> Thanks,
> Tina
It's currently a rule here not to use any javascript. as least we use it as
a last resort.
T
"Saber" <saber[-.-AT.--]maghalat.com> wrote in message
news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> why not use javascript instead?
>
> --
> Saber S.
> http://maghalat.com (Persian)
> "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
> >I have an aspx page that is always invoked by Response.Redirect calls
from
> > other pages. I want my aspx page to always display in a new browser
> > window.
> > Since the Response.Redirect calls from the other pages can't inoke
_blank
> > as
> > a target value, is there any way I can ensure that my aspx page always
> > displays in a new browser window?
> > Thanks,
> > Tina
You can't open a new window from the server. It's a client-side task that
can be accomplished only with a client-side script.
I am just wondering how many successful asp.net sites has the person who
wrote your rules made?
Eliyahu
"T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
> It's currently a rule here not to use any javascript. as least we use it
as
> a last resort.
> T
> "Saber" <saber[-.-AT.--]maghalat.com> wrote in message
> news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> > why not use javascript instead?
> > --
> > Saber S.
> > http://maghalat.com (Persian)
> > "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> > news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
> > >I have an aspx page that is always invoked by Response.Redirect calls
> from
> > > other pages. I want my aspx page to always display in a new browser
> > > window.
> > > Since the Response.Redirect calls from the other pages can't inoke
> _blank
> > > as
> > > a target value, is there any way I can ensure that my aspx page always
> > > displays in a new browser window?
> > > Thanks,
> > > Tina
> >
That's not true. take an ordinary Hyperlink on any aspx page that links to
another aspx page. set it's target property to _blank and the new aspx page
will pop up in a new browser window. No client script was involved. I'm
just trying to do the same thing from a respnse.redirect that we all often
do from hyperlinks.
T
"Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
news:Ov7BNzZjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> You can't open a new window from the server. It's a client-side task that
> can be accomplished only with a client-side script.
> I am just wondering how many successful asp.net sites has the person who
> wrote your rules made?
> Eliyahu
> "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
> > It's currently a rule here not to use any javascript. as least we use
it
> as
> > a last resort.
> > T
> > "Saber" <saber[-.-AT.--]maghalat.com> wrote in message
> > news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> > > why not use javascript instead?
> > > > > --
> > > Saber S.
> > > http://maghalat.com (Persian)
> > > "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> > > news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
> > > >I have an aspx page that is always invoked by Response.Redirect calls
> > from
> > > > other pages. I want my aspx page to always display in a new browser
> > > > window.
> > > > Since the Response.Redirect calls from the other pages can't inoke
> > _blank
> > > > as
> > > > a target value, is there any way I can ensure that my aspx page
always
> > > > displays in a new browser window?
> > > > Thanks,
> > > > Tina
> > > > > >
Admitting the mistake in the first statement, thank you, I am still
insisting that you can't make anything more-or-less meaningful in ASP.NET
without good deal of javascripting.
Eliyahu
"GaryB" <gb@.nospam.com> wrote in message
news:O$SZIO7jEHA.3456@.TK2MSFTNGP12.phx.gbl...
> That's not true. take an ordinary Hyperlink on any aspx page that links
to
> another aspx page. set it's target property to _blank and the new aspx
page
> will pop up in a new browser window. No client script was involved. I'm
> just trying to do the same thing from a respnse.redirect that we all often
> do from hyperlinks.
> T
>
> "Eliyahu Goldin" <removemeegoldin@.monarchmed.com> wrote in message
> news:Ov7BNzZjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> > You can't open a new window from the server. It's a client-side task
that
> > can be accomplished only with a client-side script.
> > I am just wondering how many successful asp.net sites has the person who
> > wrote your rules made?
> > Eliyahu
> > "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> > news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
> > > It's currently a rule here not to use any javascript. as least we use
> it
> > as
> > > a last resort.
> > > T
> > > > "Saber" <saber[-.-AT.--]maghalat.com> wrote in message
> > > news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
> > > > why not use javascript instead?
> > > > > > > > --
> > > > Saber S.
> > > > http://maghalat.com (Persian)
> > > > "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
> > > > news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
> > > > >I have an aspx page that is always invoked by Response.Redirect
calls
> > > from
> > > > > other pages. I want my aspx page to always display in a new
browser
> > > > > window.
> > > > > Since the Response.Redirect calls from the other pages can't inoke
> > > _blank
> > > > > as
> > > > > a target value, is there any way I can ensure that my aspx page
> always
> > > > > displays in a new browser window?
> > > > > Thanks,
> > > > > Tina
> > > > > > > > > > > >
a rule not to use javascript - I am very curious as to why ... and who made
the tech choice to go with .NET? obviously they had a great handle on the
workings of the framework ...
"T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
news:O$veA1RjEHA.1184@.TK2MSFTNGP12.phx.gbl...
> It's currently a rule here not to use any javascript. as least we use it
> as
> a last resort.
> T
> "Saber" <saber[-.-AT.--]maghalat.com> wrote in message
> news:ek3TiRKjEHA.3696@.TK2MSFTNGP15.phx.gbl...
>> why not use javascript instead?
>>
>>
>> --
>> Saber S.
>> http://maghalat.com (Persian)
>> "T. Seaburn" <tinamseaburn@.removespamexcite.com> wrote in message
>> news:O1hXGsJjEHA.3320@.TK2MSFTNGP11.phx.gbl...
>> >I have an aspx page that is always invoked by Response.Redirect calls
> from
>> > other pages. I want my aspx page to always display in a new browser
>> > window.
>> > Since the Response.Redirect calls from the other pages can't inoke
> _blank
>> > as
>> > a target value, is there any way I can ensure that my aspx page always
>> > displays in a new browser window?
>> > Thanks,
>> > Tina
>>>>
>>
Targeting a database path that is outside of the current project?
Well, good thing that the forum stated "No question too simple" because I'm sure this is uber basic...
I have a working Default.aspx page that accesses a database (hsDatabase.mdf) within the App_Data folder. Just the basic ASP website structure automatically made by Visual Web Developer 2005 Express Edition.
The page works fine on the local computer.
The problem is, when I put it up on my server on the web, the server requires all databases to be put in a specific "database" folder which is up a level from the html folder where I put my ASP and HTML files. That is, it's outside of the project folder.
And try as I might, I can't seem to get the Default.aspx page to connect with database when it's not residing in a folder called "App_Data" which is at the same level as the ASP file.
I assume that the key lies in how I write the connectionstring in the web.config file?
This is the connectionstring that works on my computer:
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\hsDatabase.mdf;Integrated Security=True;User Instance=True"
But instead of|DataDirectory|\hsDatabase.mdf, I wish I could just put write a hardcoded address like www.mySite.com/database/hsDatabase.mdf.
Or at least a relative path that worked like../../database/hsDatabase.mdf
How can I connect to a database that's outside of my project folder, or anywhere on the web for that matter?
Thanks everyone!
Hopefully this helps -
Imports System.Data.SqlClientImports System.IOImports System.Web.ConfigurationPartialClass DefaultInherits System.Web.UI.PageProtected Sub Page_Load(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles Me.LoadDim bldrAs New SqlConnectionStringBuilder(WebConfigurationManager.ConnectionStrings("connectionStringName").ConnectionString) bldr.AttachDBFilename = Path.GetFullPath("/otherDir/hsDatabase.mdf")' output modified connection string Response.Write(bldr.ConnectionString &"<hr/>")End SubEnd ClassWell, that's a bit more complicated that I thought it would be! Definitely a change from the old ASP style of doing it.
The outputted modified connection string (bldr.ConnectionString),should I be putting that result into my Default.aspx page or my web.config page? And how do I pass that variable from this .aspx.vb page into the correct page?
BTW... the connection code for the Default.aspx page is: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
while the web.config page is: <connectionStrings>
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\hsDatabase.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Thank you so much again!
Hi robchis,
My suggestion could be wrong,so please correct me if you find any mistakes within my suggestion.Based on my understanding and experience,I think of course you can access the database which is outside of your website root directory. I used to access a sql database which is hosted by another server machine from my website and it works fine. The point is, make sure that the data server has sql-server serverside installed with service correctlly configured and started, then within you website, you can click the "configure Data Source" from you sqldatasource control and input the right sql-server server name and choose the right database.After that you will be able to access the database in your site.
For more and detailed information, please refer to:
http://msdn2.microsoft.com/en-us/library/ms178361.aspx
http://dotnetjunkies.com/QuickStartv20/aspnet/doc/data/databases.aspx
TargetSchema meta tag and TargetSchema attribute
If I'm building an application that I want to be browser-independant,should I eliminate this meta tag and attribute, should I add additionalmeta tags and attributes, or will any of these actions make adifference?
Thanks in advance for your help!
Hi there,
Just add following in your web.config file.. This should do the job for you.
<browserCaps>
tagwriter=System.Web.UI.HtmlTextWriter
</browserCaps>
Regards,
Thanks a lot for your reply ... I'm going to read up on browerCaps.
However, I'd still like specific information concerning my questions about the TargetSchema metatag and @.Control attribute. I'd appreciate any help.
Thanks again.
Targetting the frameset from the address bar
I have a Web application using frameset and frames. When I click in a
hyperlink button I can send the selected aspx page using the "target"
attribute into the selected frame. However when the aspx page is called from
IE address bar the page is loaded into the entire browser and not into the
frame I would like to. I tried to use the target attribute of the attribute
form but it does not work.
I noticed that when the page is called from the address bar the content of
"Request.UrlReferrer" is null but I do not find how to send this page into
the desired frame programmatically.
It would be appreciated if anybody knows how to redirect the page into the
frame.
Thanks in advance
PetePut this in the HEAD section of the subframe pages that people could try to
load without the main frameset page:
<SCRIPT LANGUAGE="JavaScript">
<!--
if (top.location.href.indexOf("frameset.aspx") == -1)
top.location.href = "frameset.aspx";
// -->
</SCRIPT>
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Pierre" wrote:
Quote:
Originally Posted by
Hello fellows,
I have a Web application using frameset and frames. When I click in a
hyperlink button I can send the selected aspx page using the "target"
attribute into the selected frame. However when the aspx page is called from
IE address bar the page is loaded into the entire browser and not into the
frame I would like to. I tried to use the target attribute of the attribute
form but it does not work.
I noticed that when the page is called from the address bar the content of
"Request.UrlReferrer" is null but I do not find how to send this page into
the desired frame programmatically.
It would be appreciated if anybody knows how to redirect the page into the
frame.
Thanks in advance
Pete
Thanks a lot Peter
After a dummy test with frameset I finally got what I need with your answer.
Regards,
Pete
"Peter Bromberg [C# MVP]" wrote:
Quote:
Originally Posted by
Put this in the HEAD section of the subframe pages that people could try to
load without the main frameset page:
>
<SCRIPT LANGUAGE="JavaScript">
<!--
>
if (top.location.href.indexOf("frameset.aspx") == -1)
top.location.href = "frameset.aspx";
>
// -->
</SCRIPT>
>
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Pierre" wrote:
>
Quote:
Originally Posted by
Hello fellows,
I have a Web application using frameset and frames. When I click in a
hyperlink button I can send the selected aspx page using the "target"
attribute into the selected frame. However when the aspx page is called from
IE address bar the page is loaded into the entire browser and not into the
frame I would like to. I tried to use the target attribute of the attribute
form but it does not work.
I noticed that when the page is called from the address bar the content of
"Request.UrlReferrer" is null but I do not find how to send this page into
the desired frame programmatically.
It would be appreciated if anybody knows how to redirect the page into the
frame.
Thanks in advance
Pete
TCPClient App Question
scenario.
I wish to have an aspx page contact a server and receive messages.
Initially, a login messge is sent, then after being validated, a second
message is sent which contains data to complete a stock market trade. The
server then should respond not only once, but with several return messages.
So far all I have found are examples that send, receive, and disconnect,
which I have working. However, since all returning data to the client should
be in response to the order submitted, I cannot simply continue to resend
the original data for the trade. I need to keep the connection open and the
grab all incoming messages until the client quits.
Could anyone suggest how I should modfy the following code to keep the
connection open and continue to rceive subsequent messages?
static void Connect(String server, String message)
{
try
{
// Create a TcpClient.
// Note, for this client to work you need to have a TcpServer
// connected to the same address as specified by the server, port
// combination.
Int32 port = 13000;
TcpClient client = new TcpClient(server, port);
// Translate the passed message into ASCII and store it as a Byte array.
Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);
// Get a client stream for reading and writing.
// Stream stream = client.GetStream();
NetworkStream stream = client.GetStream();
// Send the message to the connected TcpServer.
stream.Write(data, 0, data.Length);
Console.WriteLine("Sent: {0}", message);
// Receive the TcpServer.response.
// Buffer to store the response bytes.
data = new Byte[256];
// String to store the response ASCII representation.
String responseData = String.Empty;
// Read the first batch of the TcpServer response bytes.
Int32 bytes = stream.Read(data, 0, data.Length);
responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
Console.WriteLine("Received: {0}", responseData);
// Close everything.
client.Close();
}
catch (ArgumentNullException e)
{
Console.WriteLine("ArgumentNullException: {0}", e);
}
catch (SocketException e)
{
Console.WriteLine("SocketException: {0}", e);
}
Console.WriteLine("\n Press Enter to continue...");
Console.Read();
}try doing something like this:
while(true)
{
NetworkStream stream = client.GetStream();
...
...
...
Console.WriteLine("Received: {0}", responseData);
}
client.Close();