Showing posts with label cell. Show all posts
Showing posts with label cell. Show all posts

Saturday, March 31, 2012

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 within a Table - spacing

Sometimes I want to put a table inside a cell of another table (say, to
create 3 equal divisions, etc.).
When I want the inner table's edges to correspond exactly with the edges of
the cell, I set the border (top, left, bottom, right) to zero for both the
inner table and outer table. Also padding to 0 and spacing to 0.
But, for some reason, there is still some space between the bottom of the
inner table and the bottom of the containing cell. (Equal to about 20
pixels or so). I can't figure out how to make that space go away!
--Selden McCabeSelden, I recall experiencing something similar. If you're embedding the
tables manually, try removing all the whitespace (spaces, cr's, lf's)
between the inner </table> tag and the hosting </td>.
/// M
"Selden McCabe" <seldenm@.msn.com> wrote in message
news:OejBVjo#EHA.1564@.TK2MSFTNGP09.phx.gbl...
> Sometimes I want to put a table inside a cell of another table (say, to
> create 3 equal divisions, etc.).
> When I want the inner table's edges to correspond exactly with the edges
of
> the cell, I set the border (top, left, bottom, right) to zero for both the
> inner table and outer table. Also padding to 0 and spacing to 0.
> But, for some reason, there is still some space between the bottom of the
> inner table and the bottom of the containing cell. (Equal to about 20
> pixels or so). I can't figure out how to make that space go away!
> --Selden McCabe
>
Thanks for the tip.
I also found this (by trial and error):
In the table style (select table, format\build style), there is a
line-spacing property for text.
Select custom, and set this to 0.
Even though there was no text and no other types of spaces, etc. in the
table, that last row of space went away!
Thanks again, maybe these items will help others...
--Selden
"MWells" <outbound__at_sygnal.com> wrote in message
news:%23Xe$qso%23EHA.1564@.TK2MSFTNGP09.phx.gbl...
> Selden, I recall experiencing something similar. If you're embedding the
> tables manually, try removing all the whitespace (spaces, cr's, lf's)
> between the inner </table> tag and the hosting </td>.
> /// M
> "Selden McCabe" <seldenm@.msn.com> wrote in message
> news:OejBVjo#EHA.1564@.TK2MSFTNGP09.phx.gbl...
> of
>
Thanks Selden, I like your approach better. It's a much cleaner than
hacking all the whitespace from your HTML...
Great work on the research.
/// M
"Selden McCabe" <seldenm@.msn.com> wrote in message
news:ef#g16o#EHA.3372@.TK2MSFTNGP10.phx.gbl...
> Thanks for the tip.
> I also found this (by trial and error):
> In the table style (select table, format\build style), there is a
> line-spacing property for text.
> Select custom, and set this to 0.
> Even though there was no text and no other types of spaces, etc. in the
> table, that last row of space went away!
> Thanks again, maybe these items will help others...
> --Selden
>
> "MWells" <outbound__at_sygnal.com> wrote in message
> news:%23Xe$qso%23EHA.1564@.TK2MSFTNGP09.phx.gbl...
the
edges
the
>

Table within a Table - spacing

Sometimes I want to put a table inside a cell of another table (say, to
create 3 equal divisions, etc.).
When I want the inner table's edges to correspond exactly with the edges of
the cell, I set the border (top, left, bottom, right) to zero for both the
inner table and outer table. Also padding to 0 and spacing to 0.

But, for some reason, there is still some space between the bottom of the
inner table and the bottom of the containing cell. (Equal to about 20
pixels or so). I can't figure out how to make that space go away!

--Selden McCabeSelden, I recall experiencing something similar. If you're embedding the
tables manually, try removing all the whitespace (spaces, cr's, lf's)
between the inner </table> tag and the hosting </td>.

/// M

"Selden McCabe" <seldenm@.msn.com> wrote in message
news:OejBVjo#EHA.1564@.TK2MSFTNGP09.phx.gbl...
> Sometimes I want to put a table inside a cell of another table (say, to
> create 3 equal divisions, etc.).
> When I want the inner table's edges to correspond exactly with the edges
of
> the cell, I set the border (top, left, bottom, right) to zero for both the
> inner table and outer table. Also padding to 0 and spacing to 0.
> But, for some reason, there is still some space between the bottom of the
> inner table and the bottom of the containing cell. (Equal to about 20
> pixels or so). I can't figure out how to make that space go away!
> --Selden McCabe
Thanks for the tip.

I also found this (by trial and error):
In the table style (select table, format\build style), there is a
line-spacing property for text.
Select custom, and set this to 0.
Even though there was no text and no other types of spaces, etc. in the
table, that last row of space went away!

Thanks again, maybe these items will help others...

--Selden

"MWells" <outbound__at_sygnal.com> wrote in message
news:%23Xe$qso%23EHA.1564@.TK2MSFTNGP09.phx.gbl...
> Selden, I recall experiencing something similar. If you're embedding the
> tables manually, try removing all the whitespace (spaces, cr's, lf's)
> between the inner </table> tag and the hosting </td>.
> /// M
> "Selden McCabe" <seldenm@.msn.com> wrote in message
> news:OejBVjo#EHA.1564@.TK2MSFTNGP09.phx.gbl...
>> Sometimes I want to put a table inside a cell of another table (say, to
>> create 3 equal divisions, etc.).
>> When I want the inner table's edges to correspond exactly with the edges
> of
>> the cell, I set the border (top, left, bottom, right) to zero for both
>> the
>> inner table and outer table. Also padding to 0 and spacing to 0.
>>
>> But, for some reason, there is still some space between the bottom of the
>> inner table and the bottom of the containing cell. (Equal to about 20
>> pixels or so). I can't figure out how to make that space go away!
>>
>> --Selden McCabe
>>
>>
Thanks Selden, I like your approach better. It's a much cleaner than
hacking all the whitespace from your HTML...

Great work on the research.

/// M

"Selden McCabe" <seldenm@.msn.com> wrote in message
news:ef#g16o#EHA.3372@.TK2MSFTNGP10.phx.gbl...
> Thanks for the tip.
> I also found this (by trial and error):
> In the table style (select table, format\build style), there is a
> line-spacing property for text.
> Select custom, and set this to 0.
> Even though there was no text and no other types of spaces, etc. in the
> table, that last row of space went away!
> Thanks again, maybe these items will help others...
> --Selden
>
> "MWells" <outbound__at_sygnal.com> wrote in message
> news:%23Xe$qso%23EHA.1564@.TK2MSFTNGP09.phx.gbl...
> > Selden, I recall experiencing something similar. If you're embedding
the
> > tables manually, try removing all the whitespace (spaces, cr's, lf's)
> > between the inner </table> tag and the hosting </td>.
> > /// M
> > "Selden McCabe" <seldenm@.msn.com> wrote in message
> > news:OejBVjo#EHA.1564@.TK2MSFTNGP09.phx.gbl...
> >> Sometimes I want to put a table inside a cell of another table (say, to
> >> create 3 equal divisions, etc.).
> >> When I want the inner table's edges to correspond exactly with the
edges
> > of
> >> the cell, I set the border (top, left, bottom, right) to zero for both
> >> the
> >> inner table and outer table. Also padding to 0 and spacing to 0.
> >>
> >> But, for some reason, there is still some space between the bottom of
the
> >> inner table and the bottom of the containing cell. (Equal to about 20
> >> pixels or so). I can't figure out how to make that space go away!
> >>
> >> --Selden McCabe
> >>
> >>

Wednesday, March 28, 2012

TableAdapters using values

I have created a data access layer, have a datset with several tables. In VB I would like to access a the value of a particular cell, put that value into a variable. I am unsure how to do this. So far I have,

1Imports DataSet1TableAdapters2~~~~~~34Dim testID = Request("tid")56Dim levelAs Integer = 07Dim testsTableAdapterAs New TestsTableAdapter89level = testsTableAdapter.GetTestsByTestID(testID).Rows(0).Table.Columns(1)10

I know that this is incorrect, however I wish to get the value held in row 1 column 2. Any help would be much appreciated.

Hi,

Based on my understanding, you want to get the value held in particular cell by DataAdapter. If I have misunderstood you, please feel free to tell me, thanks.

 
Dim constrAs String =""'your connection stringDim connectionAs SqlConnection =New SqlConnection(constr)Dim sqlselAs String ="select * from test"Dim sdaAs SqlDataAdapter =New SqlDataAdapter(sqlsel, connection)Dim dsAs DataSet =New DataSet() sda.Fill(ds,"table")Dim levelAs Integer = ds.Tables("table").Rows(1)(2)
 Hope this can help you.

Try this

SqlConnection conn= new SqlConnection("YOUR CONNECTION STRING")
sql = "select * from TableName"
SqlDataAdapter ad = new SqlDataAdapter(sql, conn)
DataSet DS = new DataSet()

ad.Fill(DS,"TableName") // OR ad.Fill(DS.Tables(0))

Dim lvl As Integer
lvl = (int) DS.Table(0).Rows(1)


thanks for replying.

I was hoping to do it without setting a connection string or inputting SQL into the code. I want the dataset in my DAL to take care of this. Is there any way for the tableadapter to populate a new dataSet?


Please refer to this thread below

http://forums.asp.net/p/1187777/2031770.aspx#2031770

This might give you an idea

Tablecell backcolor?

// Add the new cell that will host the child grid

TableCell newCell = new TableCell();

newCell.ColumnSpan = cellsToSpanOver;

newCell.BackColor ="#fafad2"; ************ I know this is not right

--
DavidTry to use css classes... It should be better...

--

Thanks,
Yunus Emre ALPZEN
BSc, MCSD.NET

"Fetty" <davef@.helixpoint.com> wrote in message
news:%23DVhA1uYFHA.1404@.TK2MSFTNGP09.phx.gbl...
> // Add the new cell that will host the child grid
> TableCell newCell = new TableCell();
> newCell.ColumnSpan = cellsToSpanOver;
> newCell.BackColor ="#fafad2"; ************ I know this is not right
>
> --
> David
if you look at the datatype of BackColor, you'll see its of datatype Color,
so you know you need to pass a Color. Now we look in the doc's for the Color
class. Here we see a bunch of ways to create a color, from name, from RGB,
etc. so after 60 seconds of reading the doc's we get:

newCell.BackColor = Color.FromArgb(0xfafad2);

-- bruce (sqlwork.com)

"Fetty" <davef@.helixpoint.com> wrote in message
news:%23DVhA1uYFHA.1404@.TK2MSFTNGP09.phx.gbl...
> // Add the new cell that will host the child grid
> TableCell newCell = new TableCell();
> newCell.ColumnSpan = cellsToSpanOver;
> newCell.BackColor ="#fafad2"; ************ I know this is not right
>
> --
> David

Tablecell backcolor?

// Add the new cell that will host the child grid
TableCell newCell = new TableCell();
newCell.ColumnSpan = cellsToSpanOver;
newCell.BackColor ="#fafad2"; ************ I know this is not right
DavidTry to use css classes... It should be better...
Thanks,
Yunus Emre ALPZEN
BSc, MCSD.NET
"Fetty" <davef@.helixpoint.com> wrote in message
news:%23DVhA1uYFHA.1404@.TK2MSFTNGP09.phx.gbl...
> // Add the new cell that will host the child grid
> TableCell newCell = new TableCell();
> newCell.ColumnSpan = cellsToSpanOver;
> newCell.BackColor ="#fafad2"; ************ I know this is not right
>
> --
> David
>
if you look at the datatype of BackColor, you'll see its of datatype Color,
so you know you need to pass a Color. Now we look in the doc's for the Color
class. Here we see a bunch of ways to create a color, from name, from RGB,
etc. so after 60 seconds of reading the doc's we get:
newCell.BackColor = Color.FromArgb(0xfafad2);
-- bruce (sqlwork.com)
"Fetty" <davef@.helixpoint.com> wrote in message
news:%23DVhA1uYFHA.1404@.TK2MSFTNGP09.phx.gbl...
> // Add the new cell that will host the child grid
> TableCell newCell = new TableCell();
> newCell.ColumnSpan = cellsToSpanOver;
> newCell.BackColor ="#fafad2"; ************ I know this is not right
>
> --
> David
>

TableCell

I create a TableCell by

TableCell cell = new TableCell()

but I could not find how to add a TextBox inside this cell. Any ideas?

Thanks in advance
Serdar KALAYCI
--WebControls.TextBox txt = new WebControls.TextBox();
cell.Controls.Add(txt);

Karl

"Serdar Kalayc" <serdarkalayci@.unisec.com.tr> wrote in message
news:ewP%23cXwPDHA.4024@.tk2msftngp13.phx.gbl...
> I create a TableCell by
> TableCell cell = new TableCell()
> but I could not find how to add a TextBox inside this cell. Any ideas?
> Thanks in advance
> Serdar KALAYCI
> --
Got it, here's the code if anyone wonders...

TableCell cell = new TableCell();
TextBox text1 = new TextBox();
cell.Controls.Add (text1);

"Serdar Kalayc" <serdarkalayci@.unisec.com.tr> wrote in message
news:ewP#cXwPDHA.4024@.tk2msftngp13.phx.gbl...
> I create a TableCell by
> TableCell cell = new TableCell()
> but I could not find how to add a TextBox inside this cell. Any ideas?
> Thanks in advance
> Serdar KALAYCI
> --
I have one more question. I added a Button inside a Table at design time by
changing HTML codes, but I can't access it's events or even see it in the
components list on the Properties window.

Serdar KALAYCI

"Karl Seguin" <kseguin##crea.ca> wrote in message
news:uO53SbwPDHA.1608@.TK2MSFTNGP11.phx.gbl...
> WebControls.TextBox txt = new WebControls.TextBox();
> cell.Controls.Add(txt);
> Karl
>
> "Serdar Kalayc" <serdarkalayci@.unisec.com.tr> wrote in message
> news:ewP%23cXwPDHA.4024@.tk2msftngp13.phx.gbl...
> > I create a TableCell by
> > TableCell cell = new TableCell()
> > but I could not find how to add a TextBox inside this cell. Any ideas?
> > Thanks in advance
> > Serdar KALAYCI
> > --
if you are adding an object programatically, like your butotn, you'll also
have to attach the event programatically.

in vb.net, you can use:
addhandler yourButton.click, AddressOf yourFunctionHandler

in c#, you can use:
yourButton.Click += new EventHandler(yourFunctionHandler);

Make sure that your button is created, and you attach your handler on
postback also (ie, don't wrap it in an !page.IsPostback)

Karl

"Serdar Kalayc" <serdarkalayci@.unisec.com.tr> wrote in message
news:ulgu2oxPDHA.1748@.TK2MSFTNGP11.phx.gbl...
> I have one more question. I added a Button inside a Table at design time
by
> changing HTML codes, but I can't access it's events or even see it in the
> components list on the Properties window.
> Serdar KALAYCI
>
> "Karl Seguin" <kseguin##crea.ca> wrote in message
> news:uO53SbwPDHA.1608@.TK2MSFTNGP11.phx.gbl...
> > WebControls.TextBox txt = new WebControls.TextBox();
> > cell.Controls.Add(txt);
> > Karl
> > "Serdar Kalayc" <serdarkalayci@.unisec.com.tr> wrote in message
> > news:ewP%23cXwPDHA.4024@.tk2msftngp13.phx.gbl...
> > > I create a TableCell by
> > > > TableCell cell = new TableCell()
> > > > but I could not find how to add a TextBox inside this cell. Any ideas?
> > > > Thanks in advance
> > > Serdar KALAYCI
> > > --
> > >

TableCell.Text property overwrites dynamic control

If I add a hidden input control to a tablecell and then set the cell's text
property, the hidden control is not output. If I set the text first, then
the hidden control is output but the text is not. No errors are generated.
I can make it work by adding a literal control instead of using the text
property, but why doesn't the "simple" method work?

Dim tCell As TableCell = New TableCell
Dim thidden As HtmlInputHidden = New HtmlInputHidden
thidden.ID = "h1"
thidden.Value = "hidden text"
tCell.Controls.Add(thidden)
tCell.Text = "visible text"
tRow.Cells.Add(tCell)Maybe add the text as a literal?

Joe

"Bob Voss" <bvoss@.Xspam.tsts.com> wrote in message
news:%23iH0xNNxDHA.2408@.tk2msftngp13.phx.gbl...
> If I add a hidden input control to a tablecell and then set the cell's
text
> property, the hidden control is not output. If I set the text first, then
> the hidden control is output but the text is not. No errors are
generated.
> I can make it work by adding a literal control instead of using the text
> property, but why doesn't the "simple" method work?
> Dim tCell As TableCell = New TableCell
> Dim thidden As HtmlInputHidden = New HtmlInputHidden
> thidden.ID = "h1"
> thidden.Value = "hidden text"
> tCell.Controls.Add(thidden)
> tCell.Text = "visible text"
> tRow.Cells.Add(tCell)

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

Tuesday, March 13, 2012

Tb.text = string What Won't transfer?

In the ItemDataBound event of a datagrid, I am moving data from a varchar
cell into a textbox in a template cell as follows...
mytb.text = e.item.cells(i).text
my problem/question is that this move does not move all characters. For
instance carriage returns and line feeds don't get moved, and some other non
printable characters don't get moved.
Is there any documentation or rule as to what gets moved and what gets
ingored?
Thanks,
TOf course they don't. ASP:TextBox corresponds to <input type=text>.
That's a single line input, so naturally it only takes the first line
that you stick into it.
Try HtmlTextArea (<textarea runat=server> ) if you want multiline
input.
Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
Get your own Travel Blog, with itinerary maps and photos!
http://www.blogabond.com/
no, it just eliminates the characters and picks back up with following
characters. Effectively it "strips" them
T
"Jason Kester" <jasonkester@.gmail.com> wrote in message
news:1130019965.292118.103810@.g44g2000cwa.googlegroups.com...
> Of course they don't. ASP:TextBox corresponds to <input type=text>.
> That's a single line input, so naturally it only takes the first line
> that you stick into it.
> Try HtmlTextArea (<textarea runat=server> ) if you want multiline
> input.
> Jason Kester
> Expat Software Consulting Services
> http://www.expatsoftware.com/
> --
> Get your own Travel Blog, with itinerary maps and photos!
> http://www.blogabond.com/
>
Same effect as far as you're concerned. Be careful of the ASP:Whatever
tags that have a .Text property. They will invariably reformat your
strings to ensure that it gets HtmlEntityEncoded, and often lead to
wacky behavior like you're seeing.
Did switching to Textareas help?
Jason
well, back to my original question...
Is there any documentation or rule as to what gets moved and what gets
ingored?
T
"Jason Kester" <jasonkester@.gmail.com> wrote in message
news:1130022048.185101.202910@.g49g2000cwa.googlegroups.com...
> Same effect as far as you're concerned. Be careful of the ASP:Whatever
> tags that have a .Text property. They will invariably reformat your
> strings to ensure that it gets HtmlEntityEncoded, and often lead to
> wacky behavior like you're seeing.
> Did switching to Textareas help?
> Jason
>
It's not that something will be ignored. Incase, have some "<" / ">",
you'll get a "Potentially dangerous..." exception.
To avoid this, set the property "ValidateRequest = false" in @.Page
directive.
See documentation of "@.Page directive" for more details.
Cheers,
Gaurav Vaish
http://mastergaurav.org
--