Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Saturday, March 31, 2012

Table stucture changing when panel is displayed

Hi All,
I am having a wierd problem while displaying my panel. My code is
something like this

<table>
<tr>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>button in this cell</td>
</tr>
<tr>
<td colspan=4 width=400>
<panel>literal inside the panel</panel>
</td>
</tr>
</table
this is actually the structure of my repeater control, and I am
toggling the visibility of my panel on the client side, whenever the
button in the first row is clicked.
The approach works fine when the text in the literal is shorter than
the table width, which is 400. But, when it is longer and it had to be
wrapped, the entire table structure is messed up, the colums widths are
changing at each toggle of the panel display.
However, if I insert line breaks(<br>)in literal string, so that the
string between two line breaks is less than the page width, its working
perfect.
any idea why the table structure is messed up when the string is larger
than page width.

Any help is greatly appreciated.

ThanksPavan,

I think those results will vary from browser to browser depending on how
they render.

Have you tried using percentages for the widths instead of fixed values? (I
would try that - at least for the last column with the panel in it.)

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Pavan" <pavan27@.gmail.com> wrote in message
news:1126828985.224647.157820@.z14g2000cwz.googlegr oups.com...
> Hi All,
> I am having a wierd problem while displaying my panel. My code is
> something like this
> <table>
> <tr>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>button in this cell</td>
> </tr>
> <tr>
> <td colspan=4 width=400>
> <panel>literal inside the panel</panel>
> </td>
> </tr>
> </table>
> this is actually the structure of my repeater control, and I am
> toggling the visibility of my panel on the client side, whenever the
> button in the first row is clicked.
> The approach works fine when the text in the literal is shorter than
> the table width, which is 400. But, when it is longer and it had to be
> wrapped, the entire table structure is messed up, the colums widths are
> changing at each toggle of the panel display.
> However, if I insert line breaks(<br>)in literal string, so that the
> string between two line breaks is less than the page width, its working
> perfect.
> any idea why the table structure is messed up when the string is larger
> than page width.
> Any help is greatly appreciated.
> Thanks
tables alway resize to hold their content, unless the content has overflow
rules that prevents the content from getting larger.

try (large content is scrolled):

<table>
<tr>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>button in this cell</td>
</tr>
<tr>
<td colspan=4>
<div style="width:100%;overflow:auto;">literal inside the div</div>
</td>
</tr>
</table
note: panel is not a valid html object

-- bruce (sqlwork.com)

"Pavan" <pavan27@.gmail.com> wrote in message
news:1126828985.224647.157820@.z14g2000cwz.googlegr oups.com...
> Hi All,
> I am having a wierd problem while displaying my panel. My code is
> something like this
> <table>
> <tr>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>button in this cell</td>
> </tr>
> <tr>
> <td colspan=4 width=400>
> <panel>literal inside the panel</panel>
> </td>
> </tr>
> </table>
> this is actually the structure of my repeater control, and I am
> toggling the visibility of my panel on the client side, whenever the
> button in the first row is clicked.
> The approach works fine when the text in the literal is shorter than
> the table width, which is 400. But, when it is longer and it had to be
> wrapped, the entire table structure is messed up, the colums widths are
> changing at each toggle of the panel display.
> However, if I insert line breaks(<br>)in literal string, so that the
> string between two line breaks is less than the page width, its working
> perfect.
> any idea why the table structure is messed up when the string is larger
> than page width.
> Any help is greatly appreciated.
> Thanks
Justin, Bruce,
I tried each of your approaches but unfortunately, neither of them
worked.
however, the problem is solved by packaging the literal inside the
panel with a table.

<tr>
<td colspan=4 width=400>
<panel>
<table>
<tr>
<td>literal inside the panel</td>
</tr>
</table>
</panel>
</td>
</tr
I would appreciate if anyone could explain this behavior.

Thanks.

Pavan wrote:
> Hi All,
> I am having a wierd problem while displaying my panel. My code is
> something like this
> <table>
> <tr>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>button in this cell</td>
> </tr>
> <tr>
> <td colspan=4 width=400>
> <panel>literal inside the panel</panel>
> </td>
> </tr>
> </table>
> this is actually the structure of my repeater control, and I am
> toggling the visibility of my panel on the client side, whenever the
> button in the first row is clicked.
> The approach works fine when the text in the literal is shorter than
> the table width, which is 400. But, when it is longer and it had to be
> wrapped, the entire table structure is messed up, the colums widths are
> changing at each toggle of the panel display.
> However, if I insert line breaks(<br>)in literal string, so that the
> string between two line breaks is less than the page width, its working
> perfect.
> any idea why the table structure is messed up when the string is larger
> than page width.
> Any help is greatly appreciated.
> Thanks

Table stucture changing when panel is displayed

Hi All,
I am having a wierd problem while displaying my panel. My code is
something like this
<table>
<tr>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>button in this cell</td>
</tr>
<tr>
<td colspan=4 width=400>
<panel>literal inside the panel</panel>
</td>
</tr>
</table>
this is actually the structure of my repeater control, and I am
toggling the visibility of my panel on the client side, whenever the
button in the first row is clicked.
The approach works fine when the text in the literal is shorter than
the table width, which is 400. But, when it is longer and it had to be
wrapped, the entire table structure is messed up, the colums widths are
changing at each toggle of the panel display.
However, if I insert line breaks(<br> )in literal string, so that the
string between two line breaks is less than the page width, its working
perfect.
any idea why the table structure is messed up when the string is larger
than page width.
Any help is greatly appreciated.
ThanksPavan,
I think those results will vary from browser to browser depending on how
they render.
Have you tried using percentages for the widths instead of fixed values? (I
would try that - at least for the last column with the panel in it.)
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Pavan" <pavan27@.gmail.com> wrote in message
news:1126828985.224647.157820@.z14g2000cwz.googlegroups.com...
> Hi All,
> I am having a wierd problem while displaying my panel. My code is
> something like this
> <table>
> <tr>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>button in this cell</td>
> </tr>
> <tr>
> <td colspan=4 width=400>
> <panel>literal inside the panel</panel>
> </td>
> </tr>
> </table>
> this is actually the structure of my repeater control, and I am
> toggling the visibility of my panel on the client side, whenever the
> button in the first row is clicked.
> The approach works fine when the text in the literal is shorter than
> the table width, which is 400. But, when it is longer and it had to be
> wrapped, the entire table structure is messed up, the colums widths are
> changing at each toggle of the panel display.
> However, if I insert line breaks(<br> )in literal string, so that the
> string between two line breaks is less than the page width, its working
> perfect.
> any idea why the table structure is messed up when the string is larger
> than page width.
> Any help is greatly appreciated.
> Thanks
>
tables alway resize to hold their content, unless the content has overflow
rules that prevents the content from getting larger.
try (large content is scrolled):
<table>
<tr>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>label</td>
<td width=100>button in this cell</td>
</tr>
<tr>
<td colspan=4>
<div style="width:100%;overflow:auto;">literal inside the div</div>
</td>
</tr>
</table>
note: panel is not a valid html object
-- bruce (sqlwork.com)
"Pavan" <pavan27@.gmail.com> wrote in message
news:1126828985.224647.157820@.z14g2000cwz.googlegroups.com...
> Hi All,
> I am having a wierd problem while displaying my panel. My code is
> something like this
> <table>
> <tr>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>button in this cell</td>
> </tr>
> <tr>
> <td colspan=4 width=400>
> <panel>literal inside the panel</panel>
> </td>
> </tr>
> </table>
> this is actually the structure of my repeater control, and I am
> toggling the visibility of my panel on the client side, whenever the
> button in the first row is clicked.
> The approach works fine when the text in the literal is shorter than
> the table width, which is 400. But, when it is longer and it had to be
> wrapped, the entire table structure is messed up, the colums widths are
> changing at each toggle of the panel display.
> However, if I insert line breaks(<br> )in literal string, so that the
> string between two line breaks is less than the page width, its working
> perfect.
> any idea why the table structure is messed up when the string is larger
> than page width.
> Any help is greatly appreciated.
> Thanks
>
Justin, Bruce,
I tried each of your approaches but unfortunately, neither of them
worked.
however, the problem is solved by packaging the literal inside the
panel with a table.
<tr>
<td colspan=4 width=400>
<panel>
<table>
<tr>
<td>literal inside the panel</td>
</tr>
</table>
</panel>
</td>
</tr>
I would appreciate if anyone could explain this behavior.
Thanks.
Pavan wrote:
> Hi All,
> I am having a wierd problem while displaying my panel. My code is
> something like this
> <table>
> <tr>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>label</td>
> <td width=100>button in this cell</td>
> </tr>
> <tr>
> <td colspan=4 width=400>
> <panel>literal inside the panel</panel>
> </td>
> </tr>
> </table>
> this is actually the structure of my repeater control, and I am
> toggling the visibility of my panel on the client side, whenever the
> button in the first row is clicked.
> The approach works fine when the text in the literal is shorter than
> the table width, which is 400. But, when it is longer and it had to be
> wrapped, the entire table structure is messed up, the colums widths are
> changing at each toggle of the panel display.
> However, if I insert line breaks(<br> )in literal string, so that the
> string between two line breaks is less than the page width, its working
> perfect.
> any idea why the table structure is messed up when the string is larger
> than page width.
> Any help is greatly appreciated.
> Thanks

table that i add at run time, is in the end of page

I"m using this code to add at run time:


Dim maintable As New Table()

Dim row As New TableRow()
Dim cell As New TableCell()
Dim heights As New Unit("200px")
Dim place As New PlaceHolder()
Dim mycontrol As UserControl = LoadControl("smallmenu.ascx")

maintable.Height = heights
maintable.Width = heights

cell.Height = heights
cell.Text = "yaniv"
cell.Controls.Add(mycontrol)

row.Height = heights

row.Cells.Add(cell)

maintable.Rows.Add(row)
maintable.CssClass = "maintable"

Page.Controls.Add(maintable)

place.Controls.Add(mycontrol)

the problem is that the new table sits in the end of the (after the </html> tag) so i get an error massege:
"Control '_ctl2_Button1' of type 'Button' must be placed inside a form tag with runat=server.
"

how can solve that problem?You can use

<asp:table id="maintable" runat="server" width=... height=.. ... > </asp:Table
in your aspx page rather than dynamically creating a maintable in the codebehind.

Use the codebehind to just populate the table rows and columns.

This way you can place the <asp:table... ></asp:Table> wherever you want on the aspx page.

Hope this helps.
i don't want to use the aspx page, because i want this table to inherit to all my other pages...
I dont understand...

If you want to embed the table in all your aspx pages, you can still add an empty asp Table tag like

<asp:Table id="mytable" runat="server"... ...></asp:Table> to every aspx page where you want the table to be displayed.

Now you can still dynamically populate this table from code behind...
sorry to bother, i tried thatone, but the code behind dosen't recognize this table in i add it in the aspx page. i can't run the "maintable.controls.add" in this case. even if i use the dim maintable, and don't you the page.controls.add(maintable) there is no connection between them!
I had the same problem. I asked about it yesterday (only about a DDL).

My kloogy solution was to create a wrapper class:

Public Class ItemPair
Inherits DropDownList
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
output.RenderBeginTag("form")
MyBase.Render(output)
End Sub
Protected Overrides Sub AddAttributesToRender(ByVal writer As HtmlTextWriter)
writer.RenderEndTag()
End Sub
End Class

You could probably cut and paste and change a couple words and be set.
I posted another asnwer that hasn't shown up yet but here is the link to my question which was very similar to yours:

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=516165

table to list

this code is to bring one coloumn in a listbox... when selecting that list corresponding values for that selection should be displayed in my text boxes kept in de form please some one help me...

thanks in advance......

Dim myDB As Database
Dim myRS As dao.Recordset
Dim tdf As TableDef

Private Sub DataList1_Click()

End Sub

Private Sub EXIT_Click()
Unload Me
End Sub

Private Sub Form_Load()
Set myDB = OpenDatabase("C:\deepesh\name.mdb")
Set myRS = myDB.OpenRecordset("details", dbOpenTable)
For Each tdf In myDB.TableDefs
name1.AddItem tdf.name
Next tdf
'If myRS.RecordCount > 0 Then
'myRS.MoveFirst
'End If
If Not myRS.EOF And Not myRS.BOF Then
myRS.MoveFirst
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
myRS.Close
Set myRS = Nothing
myDB.Close
Set myDB = Nothing
End Sub

Private Sub name1_Change()
Set myRS = myDB.OpenRecordset("select name,street1,street2,city,pincode,phone,pan_number from details where name=""& List1.Text &", dbopendybaset)
myRS.FindFirst "[name] = " & name1.Text & """"
If myRS.RecordCount > 0 Then
'If myRS.NoMatch = False Then
phone.Text = myRS("phone")
street1.Text = myRS("street1")
street2.Text = myRS("sreet2")
city.Text = myRS("city")
pincode.Text = myRS("pincode")
pincode.Text = myRS.Fields(5)
End If
Set myRS = Nothing
End Subbut how to add script i don understand i am new to vb so kindly help
You will need to add a bit of javascript to your listbox. Your spectacularly unstructured code makes it a little difficult to look at, but I figure that 'name1' is the name of your listbox. Use .Attributes.Add() to have it call a bit of javascript that populates a textbox on each click event.
Ok, I'll tell you half of it, since you ought to learn.

First, find out the javascript required to populate a textbox whenever an item in a listbox is clicked. Once you find that javascript, in your codebehind, use

name1.Attributes.Add("onClick",yourjavascripthere);

Keep in mind that the exact id of the textbox must be substituted in 'yourjavascripthere'. For this, you can use string concatenation and use textbox1.ClientId to get the client id of the textbox.
i seriously didnt understand a little bit... can we addd script in vb huh???
Yes. In your codebehind, you can dynamically add javascript to one of your controls. For that, you use name1.Attributes.Add().

So for example...

textbox1.Attributes.Add("onClick","alert('hello!');");

Will cause a messagebox to appear when someone clicks on textbox1.
This is ASP.Net forum and not the VB 6 forum. Please ask the moderators to move this thread to Classic VB forum.
Good call. (slaps forehead)

Table width, height setting is not working.

I am trying to divide a main page by 2 like 50% top and 50% bottom. So I tried like a code below but it doesn't divide by 50:50. It seems like 70:30. Does anybody know why it does this?
<asp:Table ID="Table1" runat="server" Width="100%" Height="100%" cellpadding="0" cellspacing="0"> <asp:TableRow ID="TableRow1" runat="server" Width="100%" Height="100%"> <asp:TableCell ID="TableCell1" runat="server" Width="100%" Height="50%">
      ...    </asp:TableCell>        <asp:TableCell ID="TableCell1" runat="server" Width="100%" Height="50%">
      ...    </asp:TableCell> <asp:TableRow><asp:table>
That was wrong code I got above. Here's the right one.
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:Table ID="Table1" runat="server" Width="100%" Height="100%" cellpadding="0" cellspacing="0"> <asp:TableRow ID="TableRow1" runat="server" Width="100%" Height="50%" > <asp:TableCell ID="TableCell1" runat="server" Width="100%" Height="100%" BackColor="red" > </asp:TableCell> </asp:TableRow> <asp:TableRow ID="TableRow2" runat="server" Width="100%" Height="50%"> <asp:TableCell ID="TableCell2" runat="server" Width="100%" Height="100%" BackColor="blue"> </asp:TableCell> </asp:TableRow> </asp:Table> </form></body></html>

Another question.

With the code above, even thought I specified the height to 50% to each, it only shows for one row not the whole page.

Please tell me how to divide a page into top half and bottom half so when I set background colors for each half, I can see the division by color.

 _____________________________________| || || || Red || || ||_____________________________________|| || || || Blue || || ||_____________________________________|To set like this.

table1_onclick generated without javascript function

Hi,

I have a website in dotnet2.0 with a masterpage.

Here is my code of page wich use the masterpage :

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="false" CodeFile="WfSelectExp.aspx.vb" Inherits="WebForm_WfSelectExp" MasterPageFile="~/MasterPage.master" Title="Appolo" Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" %><asp:Content ID="ContentSelectBL" ContentPlaceHolderID="ContentPlaceHolderCentral" runat="Server"> <table border="0" cellpadding="0" cellspacing="0" class="TABLE" width="100%"> <tr> <td colspan="2" style="height: 10px; width: 5px;"></td> </tr> <tr> <td style="width: 5px;"></td> <td align="center"> <table id="Table" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><!-- table presentation -->

And IIS will generated a page with the following code :

 <table id="TABLE1" border="0" cellpadding="0" cellspacing="0" class="TABLE" onload="javascript:CloseFenAttente()" style="height: 87%" width="100%" onclick="return TABLE1_onclick()"> <tr> <td colspan="5" style="height: 5px; width: 5px;"> <input type="hidden" name="ctl00$ContentPlaceHolderCentral$HiddenFieldPoidsTotal" id="ctl00_ContentPlaceHolderCentral_HiddenFieldPoidsTotal" value="0" /> <input type="hidden" name="ctl00$ContentPlaceHolderCentral$HiddenFieldQuantCommPAL" id="ctl00_ContentPlaceHolderCentral_HiddenFieldQuantCommPAL" value="0" /> <input type="hidden" name="ctl00$ContentPlaceHolderCentral$HiddenFieldQuantExpPAL" id="ctl00_ContentPlaceHolderCentral_HiddenFieldQuantExpPAL" value="0" /> <input type="hidden" name="ctl00$ContentPlaceHolderCentral$HiddenFieldQuantCommUL" id="ctl00_ContentPlaceHolderCentral_HiddenFieldQuantCommUL" value="0" /> <input type="hidden" name="ctl00$ContentPlaceHolderCentral$HiddenFieldQuantExpUL" id="ctl00_ContentPlaceHolderCentral_HiddenFieldQuantExpUL" value="0" /> <input type="hidden" name="ctl00$ContentPlaceHolderCentral$HiddenFieldRetour" id="ctl00_ContentPlaceHolderCentral_HiddenFieldRetour" value="0" /> </td> </tr> <tr> <td style="width: 10px; height: 59px;"></td> <td align="center" colspan="3" style="height: 59px"><!-- Table presentation -->

And as you can see you have a Table1.onclick() whereas no function is create before.

I have a lot of code around so I can not post all the page else I have to post all the website..

But it seems to be a bug in dotnet 2.0

I have search on google and found few people with the same issue, someone know more about this?

Or have a solution to this?

thanks,

I have the same problem.....

need help!!!!!!! AJAX applications are useless if very time it raises an error,isn't it?

Wednesday, March 28, 2012

TableCell Width

Hi,

Did someone know why this code does'nt work (The TableCell Width).
The cell don't have 600 and 150 like writed in width="600" and
width="150".

<asp:datagrid id="DataGrid1" runat="server"
AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Table>
<asp:TableRow>
<asp:TableCell Width="600">
<%# container.dataitem("Service")%>
</asp:TableCell>
<asp:TableCell Width="150">
Price :
<%# databinder.eval(container.dataitem,"price","{0:c}")%>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagridSalut Andre,

La datagrid fait dj une table, et ton code tente d'en ajouter une. Tu
ferais mieux de te servir d'une Label.

The datagrid already creates a table, and your code is attempting to add
another. You'd do better using a Label:

<asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"
ShowHeader="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label2" runat="server" Width="600px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:Label id="Label3" runat="server" Width="150px"></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid
Ken
Microsoft MVP [ASP.NET]
Toronto

"Andre" <lostman@.cablevision.qc.ca> wrote in message
news:uhcEiCq6DHA.3860@.tk2msftngp13.phx.gbl...
> Hi,
> Did someone know why this code does'nt work (The TableCell Width).
> The cell don't have 600 and 150 like writed in width="600" and
> width="150".
>
> <asp:datagrid id="DataGrid1" runat="server"
> AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
> <Columns>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:Table>
> <asp:TableRow>
> <asp:TableCell Width="600">
> <%# container.dataitem("Service")%>
> </asp:TableCell>
> <asp:TableCell Width="150">
> Price :
> <%# databinder.eval(container.dataitem,"price","{0:c}")%>
> </asp:TableCell>
> </asp:TableRow>
> </asp:Table>
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
> </asp:datagrid>
Une reponse en Francais, je n'en attendait pas autant ;o)))

L'ide des Label m'a sauver la vie.. de facon contourner :)
J'ai donc incorporer des Label dans ma table, donc mes Width fonctionne
parfaitement !!

Car avec seulement des Label la disposition est moin evidente, pour inscrire
les donnes sur des lignes diffrente par example..

Merci.

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:uccNiys6DHA.2412@.TK2MSFTNGP09.phx.gbl...
> Salut Andre,
> La datagrid fait dj une table, et ton code tente d'en ajouter une. Tu
> ferais mieux de te servir d'une Label.
> The datagrid already creates a table, and your code is attempting to add
> another. You'd do better using a Label:
> <asp:datagrid id="DataGrid1" runat="server" AutoGenerateColumns="False"
> ShowHeader="False">
> <Columns>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:Label id="Label2" runat="server" Width="600px"></asp:Label>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:Label id="Label3" runat="server" Width="150px"></asp:Label>
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
> </asp:datagrid>
> Ken
> Microsoft MVP [ASP.NET]
> Toronto
> "Andre" <lostman@.cablevision.qc.ca> wrote in message
> news:uhcEiCq6DHA.3860@.tk2msftngp13.phx.gbl...
> > Hi,
> > Did someone know why this code does'nt work (The TableCell Width).
> > The cell don't have 600 and 150 like writed in width="600" and
> > width="150".
> > <asp:datagrid id="DataGrid1" runat="server"
> > AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
> > <Columns>
> > <asp:TemplateColumn>
> > <ItemTemplate>
> > <asp:Table>
> > <asp:TableRow>
> > <asp:TableCell Width="600">
> > <%# container.dataitem("Service")%>
> > </asp:TableCell>
> > <asp:TableCell Width="150">
> > Price :
> > <%# databinder.eval(container.dataitem,"price","{0:c}")%>
> > </asp:TableCell>
> > </asp:TableRow>
> > </asp:Table>
> > </ItemTemplate>
> > </asp:TemplateColumn>
> > </Columns>
> > </asp:datagrid
Salut Andr,

Je suis content que a fonctionne pour toi.

En passant, il y a un newsgroup francophone
(microsoft.public.fr.dotnet.aspnet) au cas ou tu en aurais besoin.

(Il est rare Toronto que je puisse sortir mon franais. Jai passe sept
ans Qubec [Ste-Foy].)

Ken
Toronto

I'm glad that works for you.

BTW, there's a francophone newsgroup (microsoft.public.fr.dotnet.aspnet) in
case you ever need it.

(I don't often get a chance in Toronto to use my French. I lived in Ste-Foy
for seven years.)

"Andre" <lostman@.cablevision.qc.ca> wrote in message
news:ereXSky6DHA.4012@.tk2msftngp13.phx.gbl...
> Une reponse en Francais, je n'en attendait pas autant ;o)))
> L'ide des Label m'a sauver la vie.. de facon contourner :)
> J'ai donc incorporer des Label dans ma table, donc mes Width fonctionne
> parfaitement !!
> Car avec seulement des Label la disposition est moin evidente, pour
> inscrire
> les donnes sur des lignes diffrente par example..
> Merci.
>
> "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
> news:uccNiys6DHA.2412@.TK2MSFTNGP09.phx.gbl...
>> Salut Andre,
>>
>> La datagrid fait dj une table, et ton code tente d'en ajouter une. Tu
>> ferais mieux de te servir d'une Label.
>>
>> The datagrid already creates a table, and your code is attempting to add
>> another. You'd do better using a Label:
>>
>> <asp:datagrid id="DataGrid1" runat="server"
>> AutoGenerateColumns="False"
>> ShowHeader="False">
>> <Columns>
>> <asp:TemplateColumn>
>> <ItemTemplate>
>> <asp:Label id="Label2" runat="server" Width="600px"></asp:Label>
>> </ItemTemplate>
>> </asp:TemplateColumn>
>> <asp:TemplateColumn>
>> <ItemTemplate>
>> <asp:Label id="Label3" runat="server" Width="150px"></asp:Label>
>> </ItemTemplate>
>> </asp:TemplateColumn>
>> </Columns>
>> </asp:datagrid>
>>
>> Ken
>> Microsoft MVP [ASP.NET]
>> Toronto
>>
>> "Andre" <lostman@.cablevision.qc.ca> wrote in message
>> news:uhcEiCq6DHA.3860@.tk2msftngp13.phx.gbl...
>> > Hi,
>>> > Did someone know why this code does'nt work (The TableCell Width).
>> > The cell don't have 600 and 150 like writed in width="600" and
>> > width="150".
>>>> > <asp:datagrid id="DataGrid1" runat="server"
>> > AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false">
>> > <Columns>
>> > <asp:TemplateColumn>
>> > <ItemTemplate>
>> > <asp:Table>
>> > <asp:TableRow>
>> > <asp:TableCell Width="600">
>> > <%# container.dataitem("Service")%>
>> > </asp:TableCell>
>> > <asp:TableCell Width="150">
>> > Price :
>> > <%# databinder.eval(container.dataitem,"price","{0:c}")%>
>> > </asp:TableCell>
>> > </asp:TableRow>
>> > </asp:Table>
>> > </ItemTemplate>
>> > </asp:TemplateColumn>
>> > </Columns>
>> > </asp:datagrid>
>>>>

Monday, March 26, 2012

Tables troublessss

Hello all
I work with Visual Studio 2005 VB code.
My problem is when I insert a table into another table. It exist a space
between the table and the cells that contains this table.
I tried with ASP and HTML tables and the same occurs.
I also verified that CellSpacing=0 and Cellpadding=0 also I verified the no
presence of <pand <brtags in HTML code.

Someone can help me please?
Thanks.Carlos A. napisa(a):

Quote:

Originally Posted by

Hello all
I work with Visual Studio 2005 VB code.
My problem is when I insert a table into another table. It exist a space
between the table and the cells that contains this table.
I tried with ASP and HTML tables and the same occurs.
I also verified that CellSpacing=0 and Cellpadding=0 also I verified the no
presence of <pand <brtags in HTML code.
>
Someone can help me please?
Thanks.
>
>


Try to set margins to 0 for nested table element (in CSS).

table table{
margin:0;
}

--
PP
Thanks I'll try
"Przemek Ptasznik" <pptaszni@.mila.wywal.to.edu.pllwrote in message
news:ecfik5$7g2$1@.inews.gazeta.pl...

Quote:

Originally Posted by

Carlos A. napisa(a):

Quote:

Originally Posted by

>Hello all
>I work with Visual Studio 2005 VB code.
>My problem is when I insert a table into another table. It exist a space
>between the table and the cells that contains this table.
>I tried with ASP and HTML tables and the same occurs.
>I also verified that CellSpacing=0 and Cellpadding=0 also I verified the
>no presence of <pand <brtags in HTML code.
>>
>Someone can help me please?
>Thanks.
>>
>>


>
Try to set margins to 0 for nested table element (in CSS).
>
>
table table{
margin:0;
}
>
--
PP

Saturday, March 24, 2012

TabStrip code in VB.NET

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

/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 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

TAG Cloud

Hi there,

I have searched everywhere for code that would allow me to create a Tag Cloud using ASP.Net 1.1 and VBScript. All I can find are ones for PHP which leaves me with no clue.

Does anyone know/have an example on how to create one?

Thanks in advance,

TCM_

what the heck is a "TAG Cloud"?
Tag Cloud: http://en.wikipedia.org/wiki/Tag_cloud
so its a list of used tags?
A list of tags where size reflects popularity

should'nt be too hard...

i assume you would have say a table called "tags" with columns like "tagName", "tagCount", where the count would be how many times its been "used" (ie, searched or added)

then just do a sql query and order by the "tagCount", then the highest "tags" would be in the largest font, etc...

how will your tags be stored? and what are the tags used for etc? more info and i may be able to rustle up some code for you...

regards.


Hi RiCo83,

Thank you all for your comments.

To explain a little more I have a table that has many columns, but the ones of interest are Category and Count. The count column counts how many times a record has been viewed. I would like to create a TagCloud that would 'weight' the Category column with the Category (i.e. Fashion) weighted on the number of times it has been viewed. Maybe 5 different weight types? So it would look through the table at the Category column (there will be multiple records with the same Category), so we would want to somehow add up all the count for Fashion etc. and weight on the most popular?

Hopefully this makes sense. Really unsure on how to acheive this through code?

Any thoughts would be greatly appreciated.

Regards,

TCM_


take a look at the "Select Count(field)..." sql script option


Hi there,

Thanks for the suggestion. I am able to use the Count() method, however I am unsure of how to use this for multiple categories and displaying information in a Tag Cloud type effect with different font weightings etc.

Any thoughts?

Thanks again,

TCM_


Hi there, I ran across this post while trying to figure out how to build a tag cloud. I ended up whacking together a little solution that I think works well. The hard part about building one is weighting the tags. To size each tag I wanted to answer the question, "how far off average is the count of this tag?" To answer this you can calculate thestandard deviation for the set of tag counts and figure out how many standard deviations away from average each tag count is.

I also wanted a maximum tag size and a minimum tag size in the cloud (so everything stays reasonable). Since, acording to some math theory, 96% of the tag counts are only 2 standard deviations away from the average (check out that bell curve on the standard deviation page), I created a line with the based on two points: (-2s, minSize) and (2s, maxSize) where s is the standard deviation. Once we have the function for that line, we can just give it the difference between our tag count and the average tag count, and it will give us the proper size. Anything more than 2s away from average is sized to either the min size or the max size. I used pixels for size, but you could use anything I suppose. The sizes in this solution are integers though.

Here's the code. It's two classes: Tag and Tags. Tags is a list of Tag objects. To use them, create Tag objects for each row in your result set (you need the tagName and the tagCount) and add them to the Tags list. Then call SizeTags() on the list. Then you can use the Tags as the datasource in a repeater on your ASP.NET page.

Public Class Tag
Private _tagName As String
Private _tagCount As Integer
Private _tagSize As Integer

Public Sub New(ByVal tagName As String, ByVal tagCount As Integer)
_tagName = tagName
_tagCount = tagCount
End Sub

Public ReadOnly Property TagName() As String
Get
Return _tagName
End Get
End Property

Public ReadOnly Property TagCount() As Integer
Get
Return _tagCount
End Get
End Property

Public ReadOnly Property TagSize() As String
Get
Return _tagSize
End Get
End Property

Friend Sub SetTagSize(ByVal size As Integer)
_tagSize = size
End Sub

End Class

Public Class Tags
Inherits Generic.List(Of Tag)

' Sizes all the tags based on number
' minSize: The smallest you want the tags to get
' maxSize: The largest you want the tags to get
Public Sub SizeTags(ByVal minSize As Integer, ByVal maxSize As Integer)
Dim avg = AverageTagCount()
Dim s As Double = StandardDeviation(avg)

'get the slope of our line
Dim m As Double = (maxSize - minSize) / (4 * s)

'get the y-intercept
Dim b As Double = (maxSize - minSize) / 2

'now for any given deviation from average we can generate the tag size

For Each t As Tag In Me
'x is the distance from average for this tagCount
Dim x As Double = t.TagCount - avg
t.SetTagSize(CInt(m * x + b))

'Just in case the tag turned out too small
If t.TagSize < minSize Then
t.SetTagSize(minSize)
End If

'And just in case the tag turned out too big
If t.TagSize > maxSize Then
t.SetTagSize(maxSize)
End If
Next

End Sub

' Calculates the standard deviation of the tagCount of these tags
'avgerage: accepts the average so we don't have to recalculate it when needed along with the standard deviation
Private Function StandardDeviation(ByVal avgerage As Double) As Double

Dim sum As Double = 0
For Each t As Tag In Me
sum += (t.TagCount - avgerage) ^ 2
Next

Return ((1 / Me.Count) * sum) ^ 0.5
End Function

Public Function AverageTagCount() As Double
Dim sum As Integer = 0
For Each t As Tag In Me
sum += t.TagCount
Next

Return sum / Me.Count
End Function

End Class

So in asp.net 1.1, create a project with those two classes, add that project to your solution that already has your asp.net project, then reference the "TagCloud" project in your asp.net project.

Then on your page, you can add a repeater like:


<asp:Repeater ID="TagsRepeater" runat="server">
<ItemTemplate>
<a class='tag' style='font-size: <%# Eval("TagSize") %>px' href='Stuff.aspx?tag=<%# Eval("TagName") %>'><%# Eval("TagName") %></a>
</ItemTemplate>
</asp:Repeater
And in the page load on the code behind set its datasource and databind it:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim t As New Tags

With t
.Add(New Tag("52", 52))
.Add(New Tag("13", 13))
.Add(New Tag("12", 12))
.Add(New Tag("2", 2))
.Add(New Tag("3", 3))
.Add(New Tag("4", 4))
.Add(New Tag("1", 1))
.Add(New Tag("67", 67))
.Add(New Tag("67b", 67))
.Add(New Tag("120", 120))
End With

t.SizeTags(10, 60)

TagsRepeater.DataSource = t
TagsRepeater.DataBind()

End Sub

Good luck!
Oh I just had a thought, I think in ASP.NET 1.1 you'll have to use Databinder.Eval() in your aspx page rather than just Eval() ...I can't remember.
Another thing with ASP.NET 1.1 is that you can't use Generics. So you'll have to change around that Tags class and turn it into a custom collection. Sorry, I wrote this in 2.0.
Try this solution :http://www.codeproject.com/useritems/cloud.asp

Hi guys,

Thanks so much for all the help and guidance...I am still struggling to get through the code and the link provided only works in .Net 2.0. If any one has any other ideas / links / controls for VB and .Net 1.1 it would be greatly appreciated.

Will let you know how I get on.

Regards,

TCM_


Look at this:http://www.toysforthebrain.com/TagCloudTest.zip

Tag prefix

Hi all,

I have two ASP.NET newby questions:

1. what and why are there tag prefixes (example <asp:...)?
2. why doesn't the following code (in VB.NET) render these prefixes?

Dim myTextBox As New System.Web.UI.WebControls.TextBox
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)

myTextBox.RenderControl(oHtmlTextWriter)
TextBox1.Text = oStringWriter.ToString()

Regards,
BlazWhat are u trying to do?
Do u want to use ASP.NET or VB?

"Blaz Ziherl" wrote:

> Hi all,
> I have two ASP.NET newby questions:
> 1. what and why are there tag prefixes (example <asp:...)?
> 2. why doesn't the following code (in VB.NET) render these prefixes?
> Dim myTextBox As New System.Web.UI.WebControls.TextBox
> Dim oStringWriter As System.IO.StringWriter = New
> System.IO.StringWriter
> Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
> System.Web.UI.HtmlTextWriter(oStringWriter)
> myTextBox.RenderControl(oHtmlTextWriter)
> TextBox1.Text = oStringWriter.ToString()
>
> Regards,
> Blaz
blaz,

Tag prefixes are used by the asp.net compiler to identify tags that should
be processed on the server. All stardard ASP.Net control have the ASP
prefix. If you build your own controls, you can use a custom tag prefix such
as:

<blaz:newlabel id="blazlabel1" runat="server" text="" /
If you notice the rendered HTML output on the client these server controls
have been rendered as standard HTML elements such as <select>, <input>,
<img>, and so forth. Browsers such as IE and Netscape cannot parse a
<asp:label> tag, the server handles this.

For the answer to question 2. What are you trying to do?

Add a text box to a form?
Dim tbFirstName as System.Web.UI.WebControls.TextBox
Page.Controls.Add(FirstName)
Read the text of a textbox?
Dim strFirstName as String = tbFirstName.Text

HTH MikeL

"Blaz Ziherl" wrote:

> Hi all,
> I have two ASP.NET newby questions:
> 1. what and why are there tag prefixes (example <asp:...)?
> 2. why doesn't the following code (in VB.NET) render these prefixes?
> Dim myTextBox As New System.Web.UI.WebControls.TextBox
> Dim oStringWriter As System.IO.StringWriter = New
> System.IO.StringWriter
> Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
> System.Web.UI.HtmlTextWriter(oStringWriter)
> myTextBox.RenderControl(oHtmlTextWriter)
> TextBox1.Text = oStringWriter.ToString()
>
> Regards,
> Blaz
Thanks for your answers!

About the rendering. Well I am trying to add an ASP.NET WebControls
support to my application that includes a simple HTML Editor. But
can't really figure out how could I generate <asp:...></asp:...>
formatted ASP code from any of the WebControls.

Any ideas?

Regards,
Blaz

Tag prefix

Hi all,
I have two ASP.NET newby questions:
1. what and why are there tag prefixes (example <asp:...)?
2. why doesn't the following code (in VB.NET) render these prefixes?
Dim myTextBox As New System.Web.UI.WebControls.TextBox
Dim oStringWriter As System.IO.StringWriter = New
System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
System.Web.UI.HtmlTextWriter(oStringWriter)
myTextBox.RenderControl(oHtmlTextWriter)
TextBox1.Text = oStringWriter.ToString()
Regards,
BlazWhat are u trying to do?
Do u want to use ASP.NET or VB?
"Blaz Ziherl" wrote:

> Hi all,
> I have two ASP.NET newby questions:
> 1. what and why are there tag prefixes (example <asp:...)?
> 2. why doesn't the following code (in VB.NET) render these prefixes?
> Dim myTextBox As New System.Web.UI.WebControls.TextBox
> Dim oStringWriter As System.IO.StringWriter = New
> System.IO.StringWriter
> Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
> System.Web.UI.HtmlTextWriter(oStringWriter)
> myTextBox.RenderControl(oHtmlTextWriter)
> TextBox1.Text = oStringWriter.ToString()
>
> Regards,
> Blaz
>
blaz,
Tag prefixes are used by the asp.net compiler to identify tags that should
be processed on the server. All stardard ASP.Net control have the ASP
prefix. If you build your own controls, you can use a custom tag prefix suc
h
as:
<blaz:newlabel id="blazlabel1" runat="server" text="" />
If you notice the rendered HTML output on the client these server controls
have been rendered as standard HTML elements such as <select>, <input>,
<img>, and so forth. Browsers such as IE and Netscape cannot parse a
<asp:label> tag, the server handles this.
For the answer to question 2. What are you trying to do?
Add a text box to a form?
Dim tbFirstName as System.Web.UI.WebControls.TextBox
Page.Controls.Add(FirstName)
Read the text of a textbox?
Dim strFirstName as String = tbFirstName.Text
HTH MikeL
"Blaz Ziherl" wrote:

> Hi all,
> I have two ASP.NET newby questions:
> 1. what and why are there tag prefixes (example <asp:...)?
> 2. why doesn't the following code (in VB.NET) render these prefixes?
> Dim myTextBox As New System.Web.UI.WebControls.TextBox
> Dim oStringWriter As System.IO.StringWriter = New
> System.IO.StringWriter
> Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New
> System.Web.UI.HtmlTextWriter(oStringWriter)
> myTextBox.RenderControl(oHtmlTextWriter)
> TextBox1.Text = oStringWriter.ToString()
>
> Regards,
> Blaz
>
Thanks for your answers!
About the rendering. Well I am trying to add an ASP.NET WebControls
support to my application that includes a simple HTML Editor. But
can't really figure out how could I generate <asp:...></asp:...>
formatted ASP code from any of the WebControls.
Any ideas?
Regards,
Blaz

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

TagPrefix is not recognized

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

<%@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

Tags missing there end tags when they are there.

Ok I've got this real pain in the butt problem, I have copied and pasted much of my code from a template and I understand html, css, VB language pritty good, I have used my current page without problems using Visual Web Developer 2005 Express Edition for some time now....but today I've moved around a few tags located in a couple div tags and now when I try to switch to the design view from the code view a couple error's come up and tell me that 4 of my div tags are missing there end tags and 4 of my end tags are missing there div tags.........but they are all there, its just not reconizing them......how do I bind the end tag to the start tag when this happens, I've tried re-writing this bit of code which works but the next time I go into my code view and back to the design view the same error comes up...

Talk about a pain any help would be of great help...thank you.......also I know that somehow you can click a couple buttons to automaticlly arrange your code into the right format for instance this horrible messy code here

 "LoginView2" runat="server"> Welcome Back
"LoginName1" runat="server" style="left: 1px; top: 15px; z-index: 100;" Height="23px" /> "LoginStatus1" runat="server" Style="position: static" />
To this somewhat nicer code here.
 <asp:LoginView ID="LoginView2" runat="server"> <LoggedInTemplate> Welcome Back<br /> <asp:LoginName ID="LoginName1" runat="server" style="left: 1px; top: 15px; z-index: 100;" Height="23px" />    <asp:LoginStatus ID="LoginStatus1" runat="server" Style="position: static" /> </LoggedInTemplate> <AnonymousTemplate> <asp:Login ID="Login1" runat="server" BackColor="Bisque" BorderColor="#FF8000" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Bold="True" Font-Names="Palatino Linotype" Font-Size="1.3em" ForeColor="Black" Height="135px" Style="position: static" CreateUserText="Register" CreateUserUrl="~/Register.aspx" PasswordRecoveryText="Forgot Your Password?" PasswordRecoveryUrl="~/passwordRecovery.aspx"> <TitleTextStyle BackColor="#FF8000" Font-Bold="True" Font-Size="0.9em" ForeColor="White" /> <InstructionTextStyle Font-Italic="True" ForeColor="Black" /> <TextBoxStyle Font-Size="0.8em" /> <LoginButtonStyle BackColor="#FF8000" BorderColor="#FF8000" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="White" /> <CheckBoxStyle BackColor="Transparent" /> <HyperLinkStyle ForeColor="RoyalBlue" /> </asp:Login> </AnonymousTemplate> </asp:LoginView>
if you know they way to do this please let me know that might be my problem things not lining up...

P.S. my code does not look like the first example LOL

Sorry everyone I just figured this whole thing out after working on it literally for the past 5 hours haha but if you want to learn about this problem and how to incorporate <form runat=server> Tags in a masterpage and use content pages that also run off that tag then go to my very last post located here.

http://forums.asp.net/thread/1379460.aspx

Thanks.

taking a file stream and posting it to a web page

I am getting a stream that contains a PDF file and the task is to get that to a browser for the users. I was able to write code to do this with small files, but there are files so big that it can't be stored in the byte array. I wrote a loop to break down the byte array and it comes accross about the right file size, but Adobe Acrobat can't read it and says it's corrupt. I am thinking there must be a way to write the stream directly into the browser. Why do I need to build a byte array to do things like this (all the examples I find use a byte array)? Is there a way to take the stream and just run it directly into the browser?

Here is the code I have. Works as long as the file doesn't exceed the limits of the byte array:

ProtectedSub Page_Load(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.Load

'This returns the stream fine:

Dim msAs Stream = Test3A()

'Show the file on the web page

Dim bytByteStream()AsByte

ms.Seek(0, SeekOrigin.Begin)

ReDim bytByteStream(CType(ms.Length,Integer) - 1)

ms.Read(bytByteStream, 0,CInt(ms.Length))

Dim countAsInteger = 0

While count < ms.Length

bytByteStream(count) = Convert.ToByte(ms.ReadByte())

'bytByteStream(count) = ms.ReadByte()

count += 1

EndWhile

Dim brAs BinaryReader =New BinaryReader(ms)

Response.AddHeader("Content-Type","application/pdf")

Response.AddHeader("Content-Disposition","inline;filename=def.pdf")

Response.BinaryWrite(bytByteStream)

EndSub

Here is the same code with the do loop to break it down (but returns a file to the browser that Adobe Acrobat can't read: PublicSub test3c(ByVal msAs Stream) 'Show the file on the web page Dim bytByteStream()AsByte Dim intByteIndexAsInteger Response.AddHeader("Content-Type","application/pdf") Response.AddHeader("Content-Disposition","inline;filename=def.pdf") IfCType(ms.Length,Integer) > 65000Then intByteIndex = 65000 Else intByteIndex =CType(ms.Length,Integer) EndIf ms.Seek(0, SeekOrigin.Begin) ReDim bytByteStream(intByteIndex - 1) 'ms.Read(bytByteStream, 0, CInt(ms.Length)) Dim countAsInteger = 0 Dim intPlaceAsInteger = 0 Dim intCyclesAsInteger = 0 While count < ms.Length bytByteStream(intPlace) = Convert.ToByte(ms.ReadByte()) count += 1 intPlace += 1 If intPlace = 65000Then Response.BinaryWrite(bytByteStream)'Writes to the browser intCycles += 1 'Increse the cycle meter IfCType(ms.Length,Integer) - (intCycles * 65000) > 65000Then ReDim bytByteStream(65000)'If we have more than 65K more to go, set up for next chunk Else ReDim bytByteStream(CType(ms.Length,Integer) - (intCycles * 65000))'If less than 65K, then put out whatever we have left EndIf intPlace = 0 'Reset the index placment counter EndIf EndWhile Response.BinaryWrite(bytByteStream)

EndSub

MemoryStream outputStream = ' Construct the stream here...

Response.ClearContent()
Response.ClearHeaders()

Response.ContentType = "application/pdf"
Response.AppendHeader("content-disposition", "inline; filename=PDFFile.PDF")
Response.BinaryWrite(outputStream.ToArray())

outputStream.Close()

Response.End()

NC...


NC,

I see what you are going for and it would be great if it could be simple like what you are doing. However, I am getting a 'stream' from an API which I am passing to the procedure we are working on. Standard 'stream' does not have a "ToArray()" method. Is there a way to convert the stream to a memoryStream? Is there a way around this?

Schu


Try this then:

Dim ms As Stream = Test3A()
Dim outputStream As MemoryStream = CType(ms, MemoryStream)
' Rest of code...

NC...


I get the following error:

Unable to cast object of type 'EMC.Centera.BlobStreams.BlobReadStream' to type 'System.IO.MemoryStream'.

It allowed me to pull it out into a byte array as shown in my earlier code, any other ideas on what would work?

Schu


I have no idea what an 'EMC.Centera.BlobStreams.BlobReadStream' is. I tried the cast with a normal Stream object with no problem, so no, I have no idea.

Did you try:
Dim ms As MemoryStream = Test3A()

NC...


Yes, I know, that is from the API. They claim it is coming out as a simple stream (but obviously if it were we wouldn't have issues). I rewrote the code assumeing it was a memorystream and got the error:

Specified argument was out of the range of valid values.
Parameter name: offset

when I got to the "...(outputStream.ToArray()). Any thoughts?


I was looking through the documentation for this vendor code (sparse) and they mention that the stream is a "blobstream". then it says "that is what your VB code will use to Read - the Stream.Read method."

So, is there a way to convert a blob stream into a memorystream?

Schu


Well, since I have no access to the API that you are using, and all the references to "BlobStream" seem to be Java API related, who can tell? I'd request help from the vendor that created the API as I don't think that you will get much help here.

You know, if you could write the BlobStream thing to a temporary file, this would work:

Dim fileName As String = Server.MapPath("~\Reports\TestPdfFile.pdf")

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(fileName)
Response.Flush()
Response.Close()

NC...


Yea, that's a good idea too. Late last night I got together with a couple of the sr devs here and we came up with the following solution that seems to be working. I rem'd out the code that I had in the earlier post so you can see that all I did was remove a section. Thanks for your help! :)

'Show the file on the web page

Dim bytByteStream()AsByte

'ms.Seek(0, SeekOrigin.Begin) ReDim bytByteStream(CType(ms.Length,Integer) - 1) ms.Read(bytByteStream, 0,CInt(ms.Length)) 'Dim count As Integer = 0 'While count < ms.Length ' '>>Following line produces error: ' ' "Value was either too large or too small for an unsigned byte." ' bytByteStream(count) = Convert.ToByte(ms.ReadByte()) ' '>>also tried this which did not work ' ' "Arithmetic operation resulted in an overflow." ' 'bytByteStream(count) = ms.ReadByte() ' count += 1 'End While Response.AddHeader("Content-Type","application/pdf") Response.AddHeader("Content-Disposition","inline;filename=def.pdf")

Response.BinaryWrite(bytByteStream)


Well, I was wondering why you seemed to be filling the Byte array and then refilling it in the loop, but I guess I got side-tracked on the MemoryStream thing. Glad you got it.

NC...

Taking over project

Anyone got any pointers on taking over code from another consultant? I have
some ASP.NET code, some assemblies with the projects to build the dlls in
the bin folder, and all the code and pages that are on the production
server. Now I am going to have to set up the development environment. This
does not look as simple as opening the project in VS.NET or is it?Hi Ron,

You might find it faster to create your own project in VS.NET and start
dropping the other person's .aspx and .vb files in it. See if you can get it
to build before you make any changes.

Although you can sometimes open someone else's solution or project, there
are usually path changes and Web site configuration setting that don't match
up. You spend more time trying to make it work than you would creating your
own project and copying the files.

Ken

"Ron Weldy" <ronweldy@.msn.com> wrote in message
news:%23xM8XvKAFHA.2552@.TK2MSFTNGP09.phx.gbl...
> Anyone got any pointers on taking over code from another consultant? I
> have some ASP.NET code, some assemblies with the projects to build the
> dlls in the bin folder, and all the code and pages that are on the
> production server. Now I am going to have to set up the development
> environment. This does not look as simple as opening the project in VS.NET
> or is it?
Good point. Thanks!

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:u1skl0KAFHA.1400@.TK2MSFTNGP11.phx.gbl...
> Hi Ron,
> You might find it faster to create your own project in VS.NET and start
> dropping the other person's .aspx and .vb files in it. See if you can get
> it to build before you make any changes.
> Although you can sometimes open someone else's solution or project, there
> are usually path changes and Web site configuration setting that don't
> match up. You spend more time trying to make it work than you would
> creating your own project and copying the files.
> Ken
> "Ron Weldy" <ronweldy@.msn.com> wrote in message
> news:%23xM8XvKAFHA.2552@.TK2MSFTNGP09.phx.gbl...
>> Anyone got any pointers on taking over code from another consultant? I
>> have some ASP.NET code, some assemblies with the projects to build the
>> dlls in the bin folder, and all the code and pages that are on the
>> production server. Now I am going to have to set up the development
>> environment. This does not look as simple as opening the project in
>> VS.NET or is it?
>

Taking over project

Anyone got any pointers on taking over code from another consultant? I have
some ASP.NET code, some assemblies with the projects to build the dlls in
the bin folder, and all the code and pages that are on the production
server. Now I am going to have to set up the development environment. This
does not look as simple as opening the project in VS.NET or is it?Hi Ron,
You might find it faster to create your own project in VS.NET and start
dropping the other person's .aspx and .vb files in it. See if you can get it
to build before you make any changes.
Although you can sometimes open someone else's solution or project, there
are usually path changes and Web site configuration setting that don't match
up. You spend more time trying to make it work than you would creating your
own project and copying the files.
Ken
"Ron Weldy" <ronweldy@.msn.com> wrote in message
news:%23xM8XvKAFHA.2552@.TK2MSFTNGP09.phx.gbl...
> Anyone got any pointers on taking over code from another consultant? I
> have some ASP.NET code, some assemblies with the projects to build the
> dlls in the bin folder, and all the code and pages that are on the
> production server. Now I am going to have to set up the development
> environment. This does not look as simple as opening the project in VS.NET
> or is it?
>
Good point. Thanks!
"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> wrote in message
news:u1skl0KAFHA.1400@.TK2MSFTNGP11.phx.gbl...
> Hi Ron,
> You might find it faster to create your own project in VS.NET and start
> dropping the other person's .aspx and .vb files in it. See if you can get
> it to build before you make any changes.
> Although you can sometimes open someone else's solution or project, there
> are usually path changes and Web site configuration setting that don't
> match up. You spend more time trying to make it work than you would
> creating your own project and copying the files.
> Ken
> "Ron Weldy" <ronweldy@.msn.com> wrote in message
> news:%23xM8XvKAFHA.2552@.TK2MSFTNGP09.phx.gbl...
>