Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

Saturday, March 31, 2012

table run at server

I want to have an table like this
<table>
if session("userid") <> "" then
<tr><td><droplist></td></tr>
else
<tr><td><hiddeninput></td></tr>
end If

Anybody know how to solve that in .NET and codebehind?Hi,

HTML
=====


<TABLE id="Table1" border="0">
<TR>
<TD>
<asp:DropDownList id="DropDownList1" runat="server">
<asp:ListItem Value="BlahBlah">BlahBlah</asp:ListItem>
</asp:DropDownList>
</TD>
</TR>
</TABLE>

code-behind
===========


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Session("userid") <> "" Then
DropDownList1.Visible = True
Else
DropDownList1.Visible = False
End If

End Sub

HTH
Thanks, but i asked for the tablerow, cause I have labels and so on that don't is supposed to been shown either.

I solved it surfing around like. (My Row that is going to be hidden is Row #3.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Session("userid") <> "" Then
Table1.Rows(3).Visible = True
Else
Table1.Rows(3)..Visible = False
End If
End Sub

table server control -- make column invisible

I have a table server control (System.Web.UI.WebControls.Table) on my form
that has three columns. Sometimes I need the second column to be invisible,
sometimes the third. How can I set a column to be invisible in code? There
appears to not be a programmatic way to work with columns in the way that
there is rows.

Thanks.

--SusanI don't think there a Column Visible property for the WebControls.Table object. So you may have to handle this on your own

For example
foreach(TableRow tr in myTable.Rows

tr.Cells[yourcolumnindex].Visible = false

HTH
Suresh

-- Susan Geller wrote: --

I have a table server control (System.Web.UI.WebControls.Table) on my for
that has three columns. Sometimes I need the second column to be invisible
sometimes the third. How can I set a column to be invisible in code? Ther
appears to not be a programmatic way to work with columns in the way tha
there is rows

Thanks

--Susa

Table. Look Everywhere. Please help me out.

Hello,

I need to create a Table at runtime and I need the TBody tag to be:

<tbody id="itemContainer" runat="server"></tbody>

I need to to define its ID and making it run at server.

I tried everthing I could think of.

How can I do this?

Thanks,

Miguel

you can use a placeholder and do a placeholder.controls.add(pass the tablehere, table is your server object)


You didn't understand. I have no problems in working at runtime.

I create everything at runtime. The problem is that I can't find a property/way to define the ID of a Table's TBody tag when created at runtime.

Thanks,

Miguel


Hi Miguel,

Based on my understanding, you want to add the table in your asp.net application dynamically. If I have misunderstood you, please feel free to let me know.

The tbody is the html control. We can add the server table dynamically. For example,

Table t = new Table();
t.ID = "t";
TableHeaderRow hr = new TableHeaderRow();
hr.ID = "hr";
t.Controls.Add(hr);
TableCell tc = new TableCell();
tc.ID = "tc";
hr.Controls.Add(tc);
tc.Text = "test";

form1.Controls.Add(t);


I hope this helps.


publicvoid CreateEmployeeList()

{

System.Web.UI.WebControls.Table Tab =new System.Web.UI.WebControls.Table();

Tab.BorderWidth =newUnit(3);

Tab.BorderColor = System.Drawing.Color.AliceBlue;

Tab.CellPadding = 1;

//Tab.CellSpacing = 1;

TableRow Tr =newTableRow();

TableCell Tc1 =newTableCell();

TableCell Tc2 =newTableCell();

TableCell Tc3 =newTableCell();

TableCell Tc4 =newTableCell();

Label label4 =newLabel();

label4.ID ="label4";

label4.Text ="Employee ID";

Tc4.Controls.Add(label4);

Tr.Cells.Add(Tc4);

Label label1 =newLabel();

label1.ID ="label1";

label1.Text ="Employee";

Tc1.Controls.Add(label1);

Tr.Cells.Add(Tc1);

Label label2 =newLabel();

label2.ID ="label2";

label2.Text ="Attendance";

Tc2.Controls.Add(label2);

Tr.Cells.Add(Tc2);

Label label3 =newLabel();

label3.ID ="label3";

label3.Text ="Remark";

Tc3.Controls.Add(label3);

Tr.Cells.Add(Tc3);

Tab.Rows.Add(Tr);

Tr.BackColor = System.Drawing.Color.AliceBlue;

EmployeeList =EmployeeReg.SelectStaff();

EmployeeReg empreg;

EmployeeNo = EmployeeList.Count;

Empid =newLabel[EmployeeList.Count];

Empname =newLabel[EmployeeList.Count];

Attendance =newRadioButtonList[EmployeeList.Count];

Remark =newTextBox[EmployeeList.Count];

for (int i = 0; i < EmployeeList.Count; i++)

{

empreg =newEmployeeReg();

empreg = EmployeeList[i];

//initialize table row

Tr =newTableRow();

//initialize columns in particular row

Tc1 =newTableCell();

Tc2 =newTableCell();

Tc3 =newTableCell();

Tc4 =newTableCell();

//Generating Employee ID in table.

Label Lbl2 =newLabel();

Lbl2.ID ="lblEmpid" + i.ToString();

Lbl2.BackColor= System.Drawing.Color.AliceBlue;

Lbl2.Text = empreg.EmployeeID.ToString();

Empid[i] = Lbl2;

Tc4.Controls.Add(Lbl2);

Tr.Cells.Add(Tc4);

//Generating Employee name in table.

Label Lbl1 =newLabel();

Lbl1.ID ="lblName" + i.ToString();

Lbl1.Text = empreg.EmployeeName.ToString();

Empname[i] = Lbl1;

Tc1.Controls.Add(Lbl1);

Tr.Cells.Add(Tc1);

//Genertaing radiobuttonlist for attendance

RadioButtonList rdbl =newRadioButtonList();

rdbl.ID ="rdblAtt" + i.ToString();

rdbl.RepeatDirection =RepeatDirection.Horizontal;

ListItem item1 =newListItem();

//item1.Text = "Present";

item1.Value ="P";

item1.Selected =true;

rdbl.Items.Add(item1);

ListItem item2 =newListItem();

// item2.Text = "Absent";

item2.Value ="A";

rdbl.Items.Add(item2);

ListItem item3 =newListItem();

// item3.Text = "Off Day";

item3.Value ="O";

rdbl.Items.Add(item3);

ListItem item4 =newListItem();

// item4.Text = "Half Day";

item4.Value ="H";

rdbl.Items.Add(item4);

Attendance[i] = rdbl;

Tc2.Controls.Add(rdbl);

Tr.Cells.Add(Tc2);

//Genertaing TextBox for Remark

TextBox Txt1 =newTextBox();

// Txt1.ID = "txtRemark" + i.ToString();

Remark[i] = Txt1;

Remark[i].ID ="txtRemark" + i.ToString();

Remark[i].Text ="";

Tc3.Controls.Add(Txt1);

Tr.Cells.Add(Tc3);

Tab.Rows.Add(Tr);

}

this.Panel1.Controls.Add(Tab);

}

Wednesday, March 28, 2012

TableFooterRow & lines

hey
ASP.NET 2.0
On a webpage I've placed a table (server control) which consist of 2 columns
("Description" and "Amount")... At the buttom of the table I have a
TableFooterRow. In this TableFooterRow I want to display the sum of all the
amounts in the table. Right above the content in the TableFooterRow I want
a line to be displayed which separate that amount from the other amounts in
the table... In addition I would like to have a double line under the amount
in TableFooterRow...
example:
xxxxx : 2 000
yyyyy: 4 000
--
total: 6 000
=========
any ideas how to accomplish this?Use css styles to set top and bottom border for the footer row.
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Jeff" <donot@.spam.me> wrote in message
news:et0C7iEVIHA.5300@.TK2MSFTNGP03.phx.gbl...
> hey
> ASP.NET 2.0
> On a webpage I've placed a table (server control) which consist of 2
> columns ("Description" and "Amount")... At the buttom of the table I have
> a TableFooterRow. In this TableFooterRow I want to display the sum of all
> the amounts in the table. Right above the content in the TableFooterRow I
> want a line to be displayed which separate that amount from the other
> amounts in the table... In addition I would like to have a double line
> under the amount in TableFooterRow...
> example:
> xxxxx : 2 000
> yyyyy: 4 000
> --
> total: 6 000
> =========
> any ideas how to accomplish this?
>
I'm trying but the borders will not display... here is how I do it:
css:
.test
{
border-top:solid 2px Black;
background-color:Green; // debug info - I see the footer get a green
background,
// so the footer is reading this
css info
border-bottom:double 2px Black
}
<asp:TableFooterRow CssClass="test">
The footer get a green background color, but no borders... what am I doing
wrong here?
It is a known effect for table rows. Set borders instead for every cell.
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"Jeff" <donot@.spam.me> wrote in message
news:%23GcKQQFVIHA.5360@.TK2MSFTNGP03.phx.gbl...
> I'm trying but the borders will not display... here is how I do it:
> css:
> .test
> {
> border-top:solid 2px Black;
> background-color:Green; // debug info - I see the footer get a green
> background,
> // so the footer is reading
> this css info
> border-bottom:double 2px Black
> }
> <asp:TableFooterRow CssClass="test">
> The footer get a green background color, but no borders... what am I doing
> wrong here?
>

Monday, March 26, 2012

Tables from web Matrix project to hosting provider

I've delevoped some tables as part of my web using the Web Matrix (ver 0.6) and SQL Server.
My question is how do I transfer the tables developed in the 'Data' tab to my web host.
There appears no obvious procedure?
Any info appreciated!Hello, what u need to do is use DTS, which comes with the SQL Server client tools. This tool will sort of back up ur data to transfer ur database to the server.

Saturday, March 24, 2012

Tabstrip dynamic functionality ?

Ive added a tabstrip to my code (see below code):


<iewc:TabStrip id="myTabStrip" runat="server" TabDefaultStyle="background-color:#d3d3d3; border:solid 1px black; font-family:verdana; font-weight:bold; font-size:8pt; color:#ffffff; width:79; height:21; text-align:center"
SepDefaultStyle="width:10px; border-bottom: solid 1px black;" TabHoverStyle="background-color:#d3d3d3"
TabSelectedStyle="background-color:#ffffff;color:#000000" Width="100%" Height="24px" AutoPostBack="True">
<iewc:Tab></iewc:Tab>
<iewc:TabSeparator></iewc:TabSeparator>
<iewc:Tab TabIndex="1"></iewc:Tab>
<iewc:TabSeparator></iewc:TabSeparator>
<iewc:Tab TabIndex="2"></iewc:Tab>
<iewc:TabSeparator></iewc:TabSeparator>
<iewc:Tab TabIndex="3"></iewc:Tab>
</iewc:TabStrip>

This works fine, but what I really want to do is dynamically add / remove tabs depending on records in a database. For example if a table in a database has 5 records, then the tabstrip displays 5 tabs, if it holds 3 records then the tabstrip displays 3 tabs.

Is this possible ?? If so, how do I go about doing this in codebehind ?

thanks
ferkh10.This post should shed some light:view post 437723

Also, there is a forum for the Internet Explorer Web Controls:view forum 91. That is a good place to ask questions related to the TabStrip and TreeView controls.

Terri

tabstrip webcontrol can not work in framework 1.1

(Type your message here)
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

(Type your message here)
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...

Tag not well formed?

I keep getting a "Parser Error Message:The server tag is not well formed" message for this. Can anyone help me understand why?

<asp:SqlDataSource ID="ctrlDataSource" runat="server"
ProviderName="System.Data.OleDb"
ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\TestDB.mdb")
Set DbConnection = Server.CreateObject("ADODB.Connection")
DbConnection.Open ConnectionString
SelectCommand="SELECT * FROM [Testtable] WHERE ID=@dotnet.itags.org.id" >

Is it the &? or Server.MapPath(@."Database\TestDB.mdb") ?


I don't think it is the &. I've seen it in sample code that uses Server.MapPath as part of the connectionstring. However, if not for the &, how would I make the Server.MapPath part of ConnectionString?

g2000:

or Server.MapPath(@."Database\TestDB.mdb") ?


I'm not sure what you mean...that there should be @. ?


doesn't it need the closing /

... /> instead of ...>


Actually, I close the tag later on, after SelectParameters. More completely, it looks like this:

<asp:SqlDataSource ID="ctrlDataSource" runat="server"
ProviderName="System.Data.OleDb"
ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\TestDB.mdb")
Set DbConnection = Server.CreateObject("ADODB.Connection")
DbConnection.Open ConnectionString
SelectCommand="SELECT * FROM [Testtable] WHERE ID=@.id"
<SelectParameters>
<asp:QueryStringParameter Name="id" QueryStringField="id" />
</SelectParameters
</asp:sqldatasource


have you tried hard-coding the conn string, as a test?


Yes. I used

<asp:SqlDataSource ID="ctrlDataSource" runat="server"
ProviderName="System.Data.OleDb"
ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\ectserver\abcuser\DataBase\Testdb.mdb"
SelectCommand="SELECT * FROM [Testtable] WHERE ID=@.id" >

Now that is a bogus path, because I don't know the real one (this is not my server). However, the error message I get back is "is not a valid path," which is what I wouldexpect since it's bogus. It no longer complains"tag is not well formed." So why is the hard-coded tag well-formed while the other one isn't? I think there must be something about the syntax of my original <asp:SqlDataSource> ?


I don't think SqlDataSource has properties like

Set DbConnection = Server.CreateObject("ADODB.Connection")
DbConnection.Open ConnectionString

I am just beginning with ASP.NET but i think you would have to use <%= Server.MapPath("Database\TestDB.mdb") %>


I don't think you can concatenate a connection string within the SqlDataSource tag.

Try creating a connection string and assigning it to the data source programmatically in your code-behind page.



Ted C:

Try creating a connection string and assigning it to the data source programmatically in your code-behind page.

OK. How would I do this?


While lookking for the exact answer to your question, I found how to set up your connection string in your Web.config file. You'd have the following as part of the Web.config...

<connectionStrings>
<add name="SqlConnectionString"
connectionString="Data Source=localhost\band;Initial Catalog=Players;
Persist Security Info=True;User ID=band;Password=letmein"
providerName="System.Data.SqlClient"/>
</connectionStrings>

... and then your SqlDataSource tag would look something like...

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:SqlConnectionString %>"
SelectCommand="SELECT [PlayerName], [PlayerManufacturerID] FROM [Player]">
</asp:SqlDataSource>

EDIT: Except I don't know if that solves your problem of dynamically building the connection string...

More searching...


OK, ConnectionString is a property of the SqlDataSource object, so you first create a string variable and use it to build your connection string dynamically...

string myConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("Database\TestDB.mdb");

...then you assign that string to the SqlDataSource's ConnectionString property...

SqlDataSource1.ConnectionString = myConnString;

You might even be able to do it in one line in the code-behind page.

SqlDataSource1.ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("Database\TestDB.mdb");

That's in C#, of course. You'd need to translate it into VB, if that's what you're using.


Ted C:

OK, ConnectionString is a property of the SqlDataSource object, so you first create a string variable and use it to build your connection string dynamically...

string myConnString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("Database\TestDB.mdb");

...then you assign that string to the SqlDataSource's ConnectionString property...

SqlDataSource1.ConnectionString = myConnString;

I tried that a little earlier, when you first suggested that maybe I could not concatenate within the tag. I tried

<%

string cstr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" + Server.MapPath("TestDB.mdb");

SqlDataSource.ConnectionString = cstr;

%>

I also tried single-line. But I kept getting back the error "CS0120:An object reference is required for the nonstatic field, method, orproperty 'System.Web.UI.WebControls.SqlDataSource.ConnectionString.get'" which is why I wound up asking how do I do it...I am not familiar with this error?


Although OLEDB can be used with SQLDATASOURCE, however why not use AccessDataSource which is built for this purpose. Actually it inherits from sqldatasource.

An example

<asp:AccessDataSource id="InvoiceAccessDataSource" DataFile="~/App_Data/Northwind.mdb" runat="server" SelectCommand="[Employee Sales By Country]" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:Parameter Name="Beginning Date" Type="DateTime" defaultValue="1/1/1997" /> <asp:Parameter Name="Ending Date" Type="DateTime" defaultValue="1/31/1997" /> </SelectParameters></asp:AccessDataSource><asp:GridView id="InvoiceGridView" runat="server" AutoGenerateColumns="True" DataSourceid="InvoiceAccessDataSource" />
http://msdn2.microsoft.com/en-us/library/8e5545e1.aspx
Should you wish to continue using Sql datasource then here is how to do it.
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html > <head runat="server"> <title>ASP.NET Example</title></head><body> <form id="form1" runat="server"> <asp:SqlDataSource id="SqlDataSource1" runat="server" DataSourceMode="DataReader" ConnectionString="<%$ ConnectionStrings:MyNorthwind%>" SelectCommand="SELECT LastName FROM Employees"> </asp:SqlDataSource> <asp:ListBox id="ListBox1" runat="server" DataTextField="LastName" DataSourceID="SqlDataSource1"> </asp:ListBox> </form> </body></html>
http://msdn2.microsoft.com/en-us/library/dz12d98w(vs.80).aspx
 
Hope that helps, please ping with any questions

tag not well formed with java and quotes problem

Here is the tag:

<asp:Image ID="Photo" runat="server" ImageUrl="Images/Loading.gif" OnLoad="SwapImage(this,'Handler.ashx?AlbumID=<%#Eval("AlbumID")%>&Size=M');" CssClass="photo_198" style="border:4px solid white" ToolTip='<%#Eval("DESCRIPTION")%>' />

I know the problem is something with the OnLoad part of the tag. and I'm pretty sure it has to do with the single quotes around the handler url. can anyone help with this? do I need to escape out of the single quote or what?

Try this

<asp:Image ID="Photo" runat="server" ImageUrl="Images/Loading.gif" OnLoad='SwapImage(this,<%# "Handler.ashx?AlbumID=" & Eval("AlbumID")%>&"Size=M");' CssClass="photo_198" style="border:4px solid white" ToolTip='<%#Eval("DESCRIPTION")%>' />
I dont have the swapImage function, so I'm not sure if it's working or not, but the error changed :)

onmouseover="<%#"javascript:clearHistory1('" & Eval("Heading") & "','" & Eval("Description") & "');"%>"


niether of those two helped, the 2nd on gives a worse error and I'm not doing a roll over image. Here is my swapImage function

 <script type="text/javascript"> function SwapImage(img,src) { img.src=src; } </script>

this is what I changed the onload part to and still get the not well formed tag error:

<asp:Image ID="Photo" runat="server" ImageUrl="Images/Loading.gif" OnLoad='<%#"SwapImage(this, 'Handler.ashx?AlbumID=" + Eval("AlbumID") +"&Size=M')"%>' CssClass="photo_198" style="border:4px solid white" ToolTip='<%#Eval("DESCRIPTION")%>' />

ASP:Image is a server side control, when you specify the onload event, it's looking for a server onload event, not a JavaScript event which is client side.

<imgonload="SwapImage(this,<%# "handler.ashx?AlbumID=" & Eval("AlbumID") & "&Size=M" %>);"src="Images/loading.gif"class="photo_198"style="border:4px solid white"ToolTip='<%#Eval("Description")%>'/>

You need a client side HTML tag like above, who's onload even will fire on the client side, not the server side.

Hope this helps.


here is the other way is wrote the Onload part and got the same error:

OnLoad="SwapImage(this, 'Handler.ashx?AlbumID=<%# Eval("AlbumID") %>&Size=M')"


thanks a lot!!! It works great! I just needed to change the onload function in the swapImage function


it looks great in firefox but in IE 7.0 the animation of the loading gif never animates and just shows the first frame. The actual image load above it, but IE says there is an error on the page and says the error is "Error: object expected"


I fixed the Error but in IE I still don't get any animation from the loading.gif, anyone know why?


It's almost assurendly a problem with your handler. Can you post the code to the handler you're using to retreive the image?


the handler returns the correct image fine. The website runs perfect with animation in firefox but IE 7.0 just stops the animation of the loading.gif at the first frame

Tagprefix to my server controls

I'd like to set the tagprefix of my server controls automatically when
they are dragged to the webform.
My code reads
<Assembly: TagPrefix("CtrlLib", "abc")>
Namespace CtrlLib
<DefaultProperty("Text"), ToolboxData("<{0}:TextBoxPlus
runat=server></{0}:TextBoxPlus>")> _
Public Class TextBoxPlus : Inherits
System.Web.UI.WebControls.TextBox
However, after adding the control to the toolbox and dragging the
control to the webform the tagprefix still reads <cc1:TextBoxPlus ...
What am I missing?
/MOn Thu, 30 Mar 2006 18:28:34 -0600, wapsiii <wapsiii@.otmail.com> wrote:

> I'd like to set the tagprefix of my server controls automatically when
> they are dragged to the webform.
> However, after adding the control to the toolbox and dragging the
> control to the webform the tagprefix still reads <cc1:TextBoxPlus ...
> What am I missing?
> /M
for 1.x?
http://weblogs.asp.net/kwarren/arch...1/07/48457.aspx
note the issue mentioned in the comments, that all controls with the same
prefix have to be in same assembly...not a huge deal, most times you are
using 1 assembly. dunno if 2.x does it differently...
Craig
Microsoft MVP - ASP/ASP.NET

Tagprefix to my server controls

I'd like to set the tagprefix of my server controls automatically when
they are dragged to the webform.

My code reads

<Assembly: TagPrefix("CtrlLib", "abc")>
Namespace CtrlLib

<DefaultProperty("Text"), ToolboxData("<{0}:TextBoxPlus
runat=server></{0}:TextBoxPlus>")> _
Public Class TextBoxPlus : Inherits
System.Web.UI.WebControls.TextBox

However, after adding the control to the toolbox and dragging the
control to the webform the tagprefix still reads <cc1:TextBoxPlus ...

What am I missing?

/MOn Thu, 30 Mar 2006 18:28:34 -0600, wapsiii <wapsiii@.otmail.com> wrote:

> I'd like to set the tagprefix of my server controls automatically when
> they are dragged to the webform.
> However, after adding the control to the toolbox and dragging the
> control to the webform the tagprefix still reads <cc1:TextBoxPlus ...
> What am I missing?
> /M

for 1.x?
http://weblogs.asp.net/kwarren/arch...1/07/48457.aspx

note the issue mentioned in the comments, that all controls with the same
prefix have to be in same assembly...not a huge deal, most times you are
using 1 assembly. dunno if 2.x does it differently...

--
Craig
Microsoft MVP - ASP/ASP.NET

Tuesday, March 13, 2012

Talking between two different web servers

I have two different servers (different ip addresses). They are running IIS. They both have access databases. The first server contains a website.

What is the simplest way to use my website to connect to the other server? My goal is to send information to the access database on the other sever. How can they communicate with one another?

Thanks

Hi,

You can create a web service on the second server. Or you can create a second web site on the second server and receive form data from the first server.


Thanks.

How can I receive data from the second server by receiving form data from the first server? Would I have to set up connection strings specifying both servers? Both servers are located in different regions and not on the same local network. For it to be possible, their IP addresses would have to be unique right? If you know of any on-line references dealing with this subject let me know.

Also these are simple MS Access databases and not MS SQL databases.

TARGET BLANK QUESTION

I would like the following link to open in a new page at a certain size, e.g 400px by 400px any ideas??

class="link" id="paints" runat="server" target="_blank" href='<%# String.Format( "details.aspx?id={0}", Container.DataItem( "ProductID" ) ) %>'>Link

thanksBeer [B]

Check out this page for the window.open method:

http://www.devguru.com/Technologies/ecmascript/quickref/win_open.html


hiya thanks for your help however I am unsure where I would put that information in my new page, the new page code I have already is.... thanks

<%@. Page Language="VB" %>
<%@. import Namespace="System.Data" %>
<%@. import Namespace="System.Web.UI.WebControls.Image" %>
<%@. import Namespace="System.Data.OleDb" %>
<script runat="server">

Sub Page_Load
Dim intProductID As Integer
Dim conMurraysdb As OleDbConnection
Dim strSelect As String
Dim cmdSelect As OleDbCommand
Dim dtrResult As OleDbDataReader


intProductID = Int32.Parse( Request.QueryString( "id" ) )


conMurraysdb = New OleDbConnection( "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=D:\Domains\murraysfordesign.co.uk\db\Murraysdb.mdb" )
strSelect = "Select * From Products WhereProductID=@.ProductID"
cmdSelect = New OleDbCommand( strSelect, conMurraysdb )
cmdSelect.Parameters.Add( "@.ProductID", intProductID )
conMurraysdb.Open()
dtrResult = cmdSelect.ExecuteReader( CommandBehavior.SingleRow )


If dtrResult.Read Then
lblResult.Text = dtrResult( "Product" )
lblPrice.Text = dtrResult( "price" )
lblSize.Text = dtrResult( "size" )
lblDescription.Text = dtrResult( "Description" )
img_product.ImageURL = dtrResult( "Image_url" )

End If

dtrResult.Close()
conMurraysdb.Close()
End Sub

</script>
<html>
<head>
<title>Details.aspx</title>
</head>
<body>
<form runat="Server">
<table height="450" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td colspan="3" height="20">

</td>
</tr>
<tr>
<td valign="top" width="120">
</td>
<td valign="top" width="338">
<p style="FONT-SIZE: 13px; COLOR: #cc3333; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif">
<b><asp:Label id="lblResult" runat="Server" font-size="12px" font-bold="True" font-names="Verdana, Arial, Helvetica, sans-serif"></asp:Label></b>
</p>
<br />
<p style="FONT-SIZE: 11px; COLOR: #333333; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif">
Description:
</p>
<blockquote><asp:Label id="lblDescription" runat="Server" font-size="11px" font-names="Verdana, Arial, Helvetica, sans-serif"></asp:Label></blockquote> <blockquote><asp:Label id="lblSize" runat="Server" font-size="11px" font-names="Verdana, Arial, Helvetica, sans-serif"></asp:Label></blockquote> <blockquote>£ <asp:Label id="lblPrice" runat="Server" font-size="11px" font-names="Verdana, Arial, Helvetica, sans-serif"></asp:Label></blockquote></td>
<td valign="top" width="342">
<asp:Image id="img_product" runat="server"></asp:Image>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>

tcp/ip

I need to connect to a server via my web page using an IP address and Port
number, this is not a web server, it is a file share server. Can anyone poin
t
me to an example on how this works?connect to it for what? But basically you will have to use the standard File
Access ports without some major working.
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:513127E1-F87B-43D9-8F1E-516FF47AA979@.microsoft.com...
>I need to connect to a server via my web page using an IP address and Port
> number, this is not a web server, it is a file share server. Can anyone
> point
> me to an example on how this works?
>
Oh, forgot to add, just add a virtual DIR in the IIS manager to point to
that server\folder, that would be easiest
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:513127E1-F87B-43D9-8F1E-516FF47AA979@.microsoft.com...
>I need to connect to a server via my web page using an IP address and Port
> number, this is not a web server, it is a file share server. Can anyone
> point
> me to an example on how this works?
>
you need to know what protocol the file share server is using.
-- bruce (sqlwork.com)
"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:513127E1-F87B-43D9-8F1E-516FF47AA979@.microsoft.com...
| I need to connect to a server via my web page using an IP address and Port
| number, this is not a web server, it is a file share server. Can anyone
point
| me to an example on how this works?
|

tcp/ip

I need to connect to a server via my web page using an IP address and Port
number, this is not a web server, it is a file share server. Can anyone point
me to an example on how this works?connect to it for what? But basically you will have to use the standard File
Access ports without some major working.

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com

"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:513127E1-F87B-43D9-8F1E-516FF47AA979@.microsoft.com...
>I need to connect to a server via my web page using an IP address and Port
> number, this is not a web server, it is a file share server. Can anyone
> point
> me to an example on how this works?
Oh, forgot to add, just add a virtual DIR in the IIS manager to point to
that server\folder, that would be easiest

--
Curt Christianson
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com

"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:513127E1-F87B-43D9-8F1E-516FF47AA979@.microsoft.com...
>I need to connect to a server via my web page using an IP address and Port
> number, this is not a web server, it is a file share server. Can anyone
> point
> me to an example on how this works?
you need to know what protocol the file share server is using.

-- bruce (sqlwork.com)

"Mike" <Mike@.discussions.microsoft.com> wrote in message
news:513127E1-F87B-43D9-8F1E-516FF47AA979@.microsoft.com...
| I need to connect to a server via my web page using an IP address and Port
| number, this is not a web server, it is a file share server. Can anyone
point
| me to an example on how this works?
|

tcp/ip

hi
the cod in this link not work:
http://planet.nana.co.il/s5d/clint.txt
http://planet.nana.co.il/s5d/server.txt
i work hard and it not work
thanksI think you'll need to tell us exactly what's not working... I'm not prepared to sift through all that text without a certain direction

TCPClient App Question

I wonder if anyone could give me a suggestion on how to best handle this
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();

TcpClient connection in app_code fails to work

Hello,

I am just getting into asp.net development (have a winforms background)

I have a sockets server running on my windows 2003 machine. I made a class called ClientTcp that opens a new connection and sends a string to the server and placed this in APP_CODE.

I call ClientTcp :

public class ClientTCP{private TcpClient tcpClient;public void SendData(String toSend) { tcpClient =new TcpClient(CONNECT_ADDR, CONNECT_PORT); NetworkStream networkStream = tcpClient.GetStream(); StreamWriter streamWriter =new StreamWriter(networkStream, System.Text.Encoding.ASCII); streamWriter.WriteLine(toSend); streamWriter.Flush(); }}

From my code behind Default.aspx.cs:

ClientTCP c =new ClientTCP();c.SendData("In app_code");

This works great on my local VS 2005 debug but when this runs under IIS 6 on Windows 2003 no data is received by the socket server.

Is there some sort of permissions issue or scope issue with using a class in APP_CODE


Interesting enough if I place the SendData method directly in the Default.aspx.cs file then it opens a socket connection and sends the data.

I have looked around for clues but could not find out why the socket wont connect and send by calling a code behind.

Thanks

I have solved this isssue.

I didn't post the complete method in my earlier post. This code works correctly.

My issue was that I was attempting to build an XmlDocument and then converting that to a string and sending that string over the stream.

It seems that I cannot create an XmlDocument in memory under IIS6. Creating a temporary file and then using this may solve the real issue but I have worked around this by building a custom string builder to generate xml compliant strings.

Thanks