Showing posts with label time. Show all posts
Showing posts with label time. 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

Monday, March 26, 2012

Tables arent sized correctly in VS2005

Im using visual studio to make my website, but im having problems with tables every time.

I use the mnouse to resize the tables cells, but every time they are shown totally wrong! If i place a table with to columns and a width of 800px and then set the left coulm to be 50 px then the shown lengt is a third of the table of that column. Also in the preview.

I havent seen this problem in dreamweaver, so i dont know if this is a setting or something that i have to set..

what does the STYLE property look like on the <table> tag?

Are any CSS classes being inherited?


Well it seems like that if i drag a cell in a table, only the width of this cell is being set and not the one in the next cell. Which means that when i get these strange sizes, then the table have the width 800px, but the first column have a width of 50px and the next have the width 150 (just and example). If i then type the proper lenghts in to the style field, then i can make it display properly.

Is this a bug in VS perhaps (a rather big bug i would say)

I would like the drag the sizes around, so that it is easier to see


not sure I follow... but remember that CSS goes down to the lowest level. If you have two colums and you set cell1 to 50 and cell2 to 50 then you get 100... if you want the table to 800 and only cell1 to 50 then make sure that cell2 has NO WIDTH SET...

I've found that NO designer is great for HTML. You are almost always better off doing it yourself from the html view.

tables in asp.net

I am using Visual Microsoft Web developer express. I am using tables to control layouts, and I have hard time controlling tables. In the design view, the layout looks perfect, but actual display of the layout on a browser is horrendous. Design view and actual view are different.

Yup. You'll also find that different browsers will display differently as well. You can live with it, control the layout precisely with specific width and height attributes as well as font sizing and hope it works in most browser, or work with CSS instead of tables. But it's the nature of the environment, you don't control what the user sees, the user and the user's browser does.

Jeff


i would have loved the older way. ie coding it and not using the design way. so that u get a better control of where you want to put the control

Tabs in an ASP.NET Application

Does anyone havea good article on how to setup Tabs in an ASP.NET
application? (VB.NET)

I am having a hard time understanding how it works and where to begin. Any
insight would be greatly appreciated.DOTNETGUY wrote:
> Does anyone havea good article on how to setup Tabs in an ASP.NET
> application? (VB.NET)
> I am having a hard time understanding how it works and where to begin. Any
> insight would be greatly appreciated.

Tabs as in hitting the TAB key, or tabs as in a tabbed form?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Tabbed forms...sorry.

"Curt_C [MVP]" wrote:

> DOTNETGUY wrote:
> > Does anyone havea good article on how to setup Tabs in an ASP.NET
> > application? (VB.NET)
> > I am having a hard time understanding how it works and where to begin. Any
> > insight would be greatly appreciated.
> Tabs as in hitting the TAB key, or tabs as in a tabbed form?
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
DOTNETGUY wrote:
> Tabbed forms...sorry.

We built our own tabbed form. Basically it was single row of table cells
where the click posted back and determined what to show in the bottom
half. We also did a version with no postback that used div's with
hide/show specified with the onclick() events of the hrefs used in the
"tab" cells.

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Has anyone created something like this Tab / Multi-page control form that
uses generic object such that it can be used in Netscape, Opera, Mozilla,
etc? The IE Webcontrols only work with, of course, IE.

"Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
news:OefC%23gjgFHA.3692@.TK2MSFTNGP09.phx.gbl...
> DOTNETGUY wrote:
> > Tabbed forms...sorry.
> We built our own tabbed form. Basically it was single row of table cells
> where the click posted back and determined what to show in the bottom
> half. We also did a version with no postback that used div's with
> hide/show specified with the onclick() events of the hrefs used in the
> "tab" cells.
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com

Thursday, March 22, 2012

taking the time now

how to i take the time now and convert it to string?
and also the other way round.

thanks..to string:

DateTime.Now.ToString()
(see overloads as well)

From string:
DateTime.Parse
DateTime.ParseExact
(see overloads as well)
i only wan the time.. i don't need the date.
Internally DateTime always stores both, so you can't avoid that when parsing from string but outputting to string you can try:

DateTime.Now.ToLongTimeString()
DateTime.Now.ToShortTimeString()

The ToString I gave earlier is perfectly valid for this as well as you output the time using string formatting

DateTime.Now.ToString("hh:mm:ss")
i tried the DateTime.Now.ToString("hh:mm:ss")
but it give me the wrong AM/PM.. how come?
Ah, it shows with 12-hour clock. Try this: "H:mm:ss"

Indeed see .NET Framework SDK for string formatting. The syntax is explained there.

Taking your database driven aspx website online.

I have created an ecommerce site using aspx and sql on my local machineat home. And it's now time to take it online and put it on ourserver. Although this is the first site ive ever created usingaspx and sql server. Does anyone know any good tutorials or FAQor anything that would assist me in getting this online... It's all newto me so any help would be greatly appreciated.
Thanx
you need a hoster that supports Asp.Net AND SQL Server.
they will have specifics on how to connect to the the SQL server
You will upload all the .aspx files ( and the directories ) and then upload your .dll's to the "bin" directory
you need to tell some hosters that you are running a .Net site so that they can make your directory an application
HTH


Hello,
What you need now is to find a host then to deploy your application. Let me help you in that
1) one you have hoster, you can access your site using FTP
2) After login to FTP upload your aspx pages to wwwroot of the server
3) Upload the /bin folder to the server also to be like that wwwroot/bin
4) You should access the MSSQL and create database in a control panelthat the hoster will give you the information on how to log in and use
Finally, if u need a great host, i can recommendserverdivision.com, they are oen of the best in .NET technology
HTH
regards