|
|
thank you so much for your time
can you please give some examples (web app or website) if you have time
because I dont know how to merage css with asp.net c#
thanks alot another time
|
|
|
|
|
Its easy to add CSS in ASP.NET, as you do in HTML. The code will be basically look like this:
<link href="css/filename.css" rel="stylesheet" type="text/css">
Or you can even place it in the same masterpage like this, inside of the head tag, you add:
<style type="text/css">
CSS ATTRIBUTES
</style>
For instance, if you are using master pages, you have to add the css links inside of it (the masterpage).
I'm not a MASTER of web development, but i can help you with something...
CSS its easy as well, gonna make some examples for you.
Lets say we have the filename.css with:
body
{
background-color: #1e1e1e;
margin: 0px;
text-align: center;
font-family: Trebuchet MS;
}
The entire webpage if I let it this way, the font will be Trebuchet MS and it will be centered.
You have 3 ways for applying CSS. By ID, by Class or by Object.
By ID:
(ASP.NET)
<asp:TextBox ID="foo"/>
(CSS)
#foo
{
color: #282828;
font-size: 12px;
font-family: Arial;
border: 1px solid #fff;
}
Here, this ASP input text will have a 1px solid white border, the color of the text inside of it will be grey, Arial and 12px size.
By Class
(ASP.NET)
<asp:TextBox ID="foo" CssClass="input">
(CSS)
.input
{
color: #282828;
font-size: 12px;
font-family: Arial;
border: 1px solid #fff;
}
This will contain the same attributes, but the only difference is that we changed them by class instead of ID.
If you have a lot of inputs its better for you to use classes rather than ID, ID is more unique related style, -when you have to change a single object style-.
Then you can also change all the inputs, all the selects, and so on of your site, like this:
input
{
color: #282828;
font-size: 12px;
font-family: Arial;
border: 1px solid #fff;
}
Where ALL the inputs will be under these style rules.
Next for you to know, is the positions, margins, paddings and floats.
Try to avoid using position: absolute or tables as one person said above, they aren't good, conceptually neither.
So the best way for you to create forms for example, is with DIVs and CSS, is even way better for reading and understanding.
After doing both ways, you realise of the quantity of lines used for nothing with tables and the worthless space they use.
Also, by using tables, each browser (firefox, chrome, opera, IE) has their own attributes for placing elements inside of rows/columns, so its not always the same way you see it in firefox than in others.
position: absolute attribute is better not to use it, as instead, try using float: left or float: right, with margin-left, margin-top, margin-right or margin-bottom properties.
The position: fixed, the one that you asked about, is to keep an element FIXED on the website and eventhough you resize the browser window, it will be mantained in the way you placed it in the window with CSS.
Hope it helps for something at least, happy designing/programming!
My best regards,
Marian.
EDITED: Oh what you can do to practice a LOT, is install the Firebug for Firefox and you can debug there in execution time, just simply "right click" in your site > Inspect Element, go to CSS tab, select the CSS file and edit it, change attributes, create new rules, etc... that's the way i learned, comparing results
modified on Sunday, March 27, 2011 7:43 PM
|
|
|
|
|
from my heart thank you soooooooooooooooooooooooooo much
|
|
|
|
|
You are very welcome, pal!
|
|
|
|
|
Tables is an outdated method.
Use <DIV> tags and float or position them.
Can put DIVs inside DIVs and use CSS Tables for formating.
You can nest a table in a DIV, but DIV is the correct method du jour.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
thanks alot for your time and reply
I would like to ask you which way is perfect when I
determine the size of tables or DIVs either pixel or the percent
actully that I know is the pixel size will not fit with all browser or computers
Is it true?
thanks alot again
|
|
|
|
|
Hello Sir/Madam,
i am facing problem last two month.
so please you have sent perfect solution.
unable to connect to visual studio's localhost web server.
i tried by reinstall the webdev.webserver from
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727..
but
it is saying 'The application failed to intialize properly (0*c0000007b).
Click ok to terminate the application.
Regards,
Nand kishor
|
|
|
|
|
First, change the subject of your question to something meaningful.
Never, put an email id in place.
Second,
when you replace/re-install WebDev.WebServer.exe, make sure you end all instances of same in task-bar, register aspnet again.
Third, the Error:
The application failed to initialize properly (0x.....)
means
'The permissions aren't setup properly on MSVBVM60.DLL in your Windows System32 folder.'
In most cases adding permissions to this file solves problem. Check this for doing so.
|
|
|
|
|
Hi
I am struggling with updating data from a web page. On the page I have a DetailsView control which is bound to a table in the SQL Server database. I have enabled Editing.
One of the fields in the table is a foreign key to a lookup table (for the Referring Hospital) in the database. I would like to have a DropdownList in the DetailsView so that the user can choose the item.
I have changed the field to a TemplateField and while the field (“HospID”) is still a TextBox the update to database works. For example when I change the LastName and click ‘Update’, the update reflects in the database.
Here is the markup:
<asp:TemplateField HeaderText="HospID" SortExpression="HospID">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HospID") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HospID") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("HospID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
However when I replace the TextBox in the EditTemplate with a DropdownList and try to update, the changes do not reflect in the database. Even if I have just changed the LastName.
The markup for the DropdownList is as follows:
<asp:TemplateField HeaderText="HospID" SortExpression="HospID">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource_RefHosp" DataTextField="HospShort"
DataValueField="HospID">
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("HospID") %>'></asp:TextBox>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("HospID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Even if I just use a basic DropdownList with no databinding the update does not work.
<asp:DropDownList ID="DropDownList_RefHosp" runat="server"
DataTextField="HospShort" DataValueField="HospID">
</asp:DropDownList>
I am stumped here so if anybody can give me some pointers it will be appreciated.
Regards.
Kobus
|
|
|
|
|
You are connected the Dropdownlist by automatically by Database connection wizard. When program starts running the values in Database which you specified is loaded Dropdownlist. Again it will not goto database to retive the values for dropdownlist. So you can't get updated values.
Instaed of that you will write the code in separate method RetriveData() to retive the data from database and add the SqlDataReader values to Dropdownlist.
Call thet method when page load and update button click methods . Take another connection object to for RetriveData() method Open the connection when RetriveData() is called and Close at the method end.
U will get updated list evrytime.
Hope you can do the coding simple try it..
|
|
|
|
|
plz give me the code for copying row from one gridview to another....
for example i have 2 gridviews......
gridview1 and gridview2
each time i click on a button,the data from table based on dropdownlist1 the row is inserted in gridview1....now i want to copy a row from gridview1 to gridview2 each time a new row is added... without overwriting the previous rows in gridview2...
|
|
|
|
|
Seema Rayat wrote: plz give me the code
This is extremely RUDE around here. We are here to help and offer assistance, not just give you code. Show what you have tried, show that you have made an effort, then someone will help.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
sorry......
i m new to this...
actually i have done that how to copy from one radgrid to another...
this is my code..plz can u help me in converting it...
SqlConnection con = new SqlConnection("Data Source=CMA-PC; Initial Catalog= master; Integrated Security=True");
SqlDataAdapter da = new SqlDataAdapter("select * from aa1 where Journal_Name='" + DropDownList1.Text + "'", con);
DataSet ds = new DataSet();
da.Fill(ds);
DataTable dt = ds.Tables[0];
DataRow dr;
dr = dt.NewRow();
GridView1.DataSource = dt;
//GridView1.DataBind();
foreach (GridViewRow r in GridView1.Rows)
{
/* Construct datatable from Existing GridView */
DataRow newrow = dt.NewRow();
newrow[0] = r.Cells[0].Text;
newrow[1] = r.Cells[1].Text;
newrow[2] = r.Cells[2].Text;
newrow[3] = r.Cells[3].Text;
newrow[4] = r.Cells[4].Text;
newrow[5] = r.Cells[5].Text;
newrow[6] = r.Cells[6].Text;
newrow[7] = r.Cells[7].Text;
newrow[8] = r.Cells[8].Text;
newrow[9] = r.Cells[9].Text;
newrow[10] = r.Cells[10].Text;
newrow[11] = r.Cells[11].Text;
/* Add to Datatable */
dt.Rows.Add(newrow);
}
/* Finally Bind the Constructed DataTable to Grid2 */
GridView2.DataSource = dt;
DataBind();
}
|
|
|
|
|
First the newbie mistakes need to be corrected. NEVER hard-code you connection strings in your code, use the web.config file. There is a section for connection strings. NEVER use string concatenation to form to the sql statement and NEVER, EVER use unvalidated values from user input.
If I understand this you want GridView1 and GridView2 to have the same data?
GridView1.DataSource = GridView2.DataSource = dt;
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I want to input below code.
But page occur error.
How can i?
<td> Time & Destination </td>
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Haha, having trouble atm getting this to display correctly as CP keeps converting it...
You need to replace the "&" with "&" - this is the HTML escape code for an ampersand character. For a full list, see here[^].
|
|
|
|
|
|
Escape codes are a bugger to remember aren't they!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Hey...I am new to this MVC 2.0.I just want to know what are the codes to download a File from database using MVC 2.0.I am using ADO.NET Entity Framework.
I am confused with layers of MVC 2.0.It has Domain(Abstract,Concrete,Entity) and WebUI.How I will use this layers to download a file.
Thanks in advance.
|
|
|
|
|
Hi,
I am not sure if this is possible. I am exploring web user controls. I have created a datalist user control (datalist.ascx). I have added this control to my default page. Now I want to bind data to this datalist. I am not sure how to do that. I am testing with user controls and any help will be appreciated.
Here is my code:
default.aspx
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Default" title="Untitled Page" %>
<%@ Register Src="datalist.ascx" TagName="datalist" TagPrefix="uc1" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>;
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<uc1:datalist ID="Datalist1" runat="server" />
</asp:Content>
default.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim cmd As New SqlCommand("ws_Testimonials")
Try
If dalaccess.Connect = True Then
rs1 = dalaccess.GetDataset(cmd, 60)
dalaccess.Disconnect()
Datalist1.datasource = rs1
Datalist1.DataBind()
End If
Catch ex As Exception
End Try
I get the compilation error that "Error 1 'datasource' is not a member of 'ASP.datalist_ascx'."
Gurus please help.
|
|
|
|
|
Just expose the Datalist of your usercontrol using properties. Once done, they will be accessible in the base page and there you can directly access and define the datasource for it.
|
|
|
|
|
Hi,
I want to log messages in event viewer from my ASP application.
Does anybody have an idea how do it?
Cheers
|
|
|
|
|
ASP or ASP.NET? If it's ASP.NET, you need the EventLog[^] class which contains various members for manipulating the event log. For instance, if you want to log to your own event source (there are certain sources already created such as the Application log and Security log), you'd use:
if (!EventLog.SourceExists("MyCustomSource"))
{
EventLog.CreateEventSource("MyCustomSource");
} Then, you can write to it using:
<br />
EventLog.WriteEntry("MyCustomSource", "This is my event body text", EventLogEntryType.Information); There are various overloads for this method - have a read up to find which is best in your particular case. Note that you shouldn't attempt to create an event source and then use it immediately, as there is a time period that the event source is being created. If you must do this, make sure that you create the event source when the application starts.
You also need to be aware that writing to the event log requires security privileges that your web account may not, by default, have. In this case, the administrator will need to ensure that the web account has privileges to write to the event log.
|
|
|
|
|
Hi all,
I am createing a report in SSRS 2008. When i select the pagebreak option then it is creating multiple tabs for each group.
but I want all the data in the single sheet instead of different tab with page break.
any solution?
Thanks in Adv
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|