|
I have thought of that.. but i don't know how to do it because i have more than 1 newlines.
My idea was to put something like "@#%x" when i want a new line and then:
string s,ss;
s = TxtNews.Text.ToString();
ss = s.Split(""@#%x");
s= ss(0) + Environment.NewLine + ss(1);
But i have more then 1 newline, and not the same number. I don't know how to count how many times "@#%x" because string method Contains returns a bool, not an number. Can someone show me another way to do it?
|
|
|
|
|
|
When you KNOW you're so new that you don't know much, you should expect that it 'doesn't work' because you did it wrong. So, post what you did, so we can see it.
However, I just see you're in the ASP.NET forum, in which case you need to insert break tags <br/> in your HTML to get a newline.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Set the MultiLine property of the TextBox to true, so that it renders as a textarea . Then it supports multiple lines, and you don't need to put any awkward codes in the text where you want line breaks.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have created a page that has frozen listview headers and it works in IE and FF. The problem is in IE 6 and 7 when you try resize the browser window, change screen resolutions, or sometimes when changing browser tabs; the relative positioned table headers jump up to the top of the page or disappear completely. FF is working correctly in all instances. I have read that there is a bug in ie 6 and 7 that causes this. All the solutions I have read have not worked for me. I have tried giving the body relative positioning and also wrapping the listview in a div and giving it absolute or relative positioning. Here is the css and asp.net code. Any help would be GREATLY appreciated.
<pre>
<head id="Head1" runat="server">
<link href="~/Styles/StyleSheet.css" rel="stylesheet" type="text/css"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ListView ID="lvJOA" runat="server" EnableViewState="False" >
<LayoutTemplate>
<div id="lvTableWrapper">
<table id="JOATable" border="1" cellpadding="5" cellspacing="0" summary="Holds the Job Listing.">
<thead>
<tr>
<th>
<asp:LinkButton runat="server" ID="lnkbtnJobClass" OnClientClick="setSortBy('JobClass')">Job Classification</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnSalary" OnClientClick="setSortBy('Salary')">Semi-Monthly Salary</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnApplicationProcess" OnClientClick="setSortBy('AppProcess')">Application Process</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnClosingDate" OnClientClick="setSortBy('ClosingDate')">Closing Date</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnVacancies" OnClientClick="setSortBy('Vacancies')">Vacancies</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnLocation" OnClientClick="setSortBy('Location')">Location</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnAgency" OnClientClick="setSortBy('Agency')">Agency</asp:LinkButton>
</th>
<th>
<asp:LinkButton runat="server" ID="lnkbtnJobCategory" OnClientClick="setSortBy('JobCategory')">Job Category</asp:LinkButton>
</th>
</tr>
</thead>
<tbody id="JOAtbody" runat="server">
<div runat="server" id="itemPlaceholder" />
</tbody>
</table>
</div>
</LayoutTemplate>
<EmptyDataTemplate>
<table style="width: 100%">
<tr><td> </td></tr>
<tr>
<td class="EmptyDataText" align="center">
No jobs found
</td>
</tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr>
<td width="0px">
<asp:HyperLink ID="hlJobClass" Target="_blank" NavigateUrl='<%# Eval("JobClassURL") %>' runat="server"><%# Eval("JobClass") %></asp:HyperLink>
</td>
<td width="0px">
<asp:Label ID="lblSalary" runat="server" Text='<%# Eval("Salary") %>'></asp:Label>
</td>
<td width="0px">
<asp:HyperLink ID="hlApplicationProcess" Target="_blank" NavigateUrl='<%# Eval("ApplicationProcessURL") %>' runat="server"><%# Eval("ApplicationProcess") %></asp:HyperLink>
</td>
<td width="0px">
<asp:Label ID="lblClosingDate" runat="server" Text='<%# Eval("ClosingDate") %>'></asp:Label>
</td>
<td width="0px">
<asp:Label ID="lblVacancies" runat="server" Text='<%# Eval("Vacancies") %>'></asp:Label>
</td>
<td width="0px">
<asp:Label ID="lblLocation" runat="server" Text='<%# Eval("Location") %>'></asp:Label>
</td>
<td width="0px">
<asp:Label ID="lblAgency" runat="server" Text='<%# Eval("Agency") %>'></asp:Label>
</td>
<td width="0px" style="padding-right: 15px;">
<asp:HyperLink ID="hlJobCategory" Target="_blank" NavigateUrl='<%# Eval("JobCategoryURL") %>' runat="server"><%# Eval("JobCategory")%></asp:HyperLink>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:Button ID="btnShowAll" runat="server" Text="Show All Jobs" onclick="btnShowAll_Click" visible="false"/>
<asp:Label ID="lblCategory" runat="server" Text="Search by Job Category: "></asp:Label>
<asp:DropDownList ID="ddlJobCategory" runat="server" AutoPostBack="True" onselectedindexchanged="ddlJobCategory_SelectedIndexChanged"></asp:DropDownList>
<asp:HiddenField ID="hdnSortBy" runat="server" />
</form>
</body>
</html>
</pre>
body
{
margin-left: 10px;
font-family:Arial, Helvetica, sans-serif;
min-width: 769px;
max-width: 990px;
height: 1170px;
position: relative;
}
#lvTableWrapper
{
width: 99%;
height: 420px;
overflow: auto;
font-size: small;
}
#lvTableWrapper #JOATable
{
border-collapse: separate;
border-top: none;
width: 98%;
/* IE Only */
#border-collapse: collapse;
}
#lvTableWrapper th
{
background-color: #000066;
color: White;
height: 30px;
text-align:center;
position: relative;
}
#lvTableWrapper tbody
{
overflow: auto;
height: 350px;
overflow-x: hidden;
}
#lvTableWrapper tr
{
height: 1px;
}
#lvTableWrapper th a:visited
{
color: White;
}
#lvTableWrapper th a:link
{
color: White;
}
|
|
|
|
|
I found a solution to this. I basically had to add another div around my lvTableWrapper div and give it relative positioning. After that I had to target the thead rows in lvTableWrapper div, which in this case is just one row and give them position:absolute;top ;left ;.
I changed the name of lvTableWrapper div when I added the extra wrapper div so it will be different in the code listed below. I may have missed some little details, so I'll post the code. I hope this helps someone...
<asp:ListView ID="lvJOA" runat="server" EnableViewState="False" >
<LayoutTemplate>
<div id="lvTableWrapperOutside">
<div id="lvTableWrapperInside">
<table id="JOATable" border="1" cellpadding="5" cellspacing="0" summary="Holds the Job Listing.">
<thead>
<tr>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnJobClass" OnClientClick="setSortBy('JobClass')">Job Classification</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnSalary" OnClientClick="setSortBy('Salary')">Semi-Monthly Salary</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnApplicationProcess" OnClientClick="setSortBy('AppProcess')">Application Process</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnClosingDate" OnClientClick="setSortBy('ClosingDate')">Closing Date</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnVacancies" OnClientClick="setSortBy('Vacancies')">Vacancies</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnLocation" OnClientClick="setSortBy('Location')">Location</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnAgency" OnClientClick="setSortBy('Agency')">Agency</asp:LinkButton>
</th>
<th scope="col">
<asp:LinkButton runat="server" ID="lnkbtnJobCategory" OnClientClick="setSortBy('JobCategory')">Job Category</asp:LinkButton>
</th>
</tr>
</thead>
<tbody id="JOAtbody" runat="server">
<div runat="server" id="itemPlaceholder" />
</tbody>
</table>
</div>
</div>
</LayoutTemplate>
<EmptyDataTemplate>
<table style="width: 100%">
<tr><td> </td></tr>
<tr>
<td class="EmptyDataText" align="center">
No jobs found
</td>
</tr>
</table>
</EmptyDataTemplate>
<ItemTemplate>
<tr>
<td width="0px">
<asp:HyperLink ID="hlJobClass" Target="_blank" NavigateUrl='<%# Eval("JobClassURL") %>' runat="server"><%# Eval("JobClass") %></asp:HyperLink>
</td>
<td width="0px">
<asp:Label ID="lblSalary" runat="server" Text='<%# Eval("Salary") %>'></asp:Label>
</td>
<td width="0px">
<asp:HyperLink ID="hlApplicationProcess" Target="_blank" NavigateUrl='<%# Eval("ApplicationProcessURL") %>' runat="server"><%# Eval("ApplicationProcess") %></asp:HyperLink>
</td>
<td width="0px">
<asp:Label ID="lblClosingDate" runat="server" Text='<%# Eval("ClosingDate") %>'></asp:Label>
</td>
<td width="0px">
<asp:Label ID="lblVacancies" runat="server" Text='<%# Eval("Vacancies") %>'></asp:Label>
</td>
<td width="0px">
<asp:Label ID="lblLocation" runat="server" Text='<%# Eval("Location") %>'></asp:Label>
</td>
<td width="0px">
<asp:Label ID="lblAgency" runat="server" Text='<%# Eval("Agency") %>'></asp:Label>
</td>
<td width="0px" style="padding-right: 15px;">
<asp:HyperLink ID="hlJobCategory" Target="_blank" NavigateUrl='<%# Eval("JobCategoryURL") %>' runat="server"><%# Eval("JobCategory")%></asp:HyperLink>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
body
{
margin-left: 10px;
font-family:Arial, Helvetica, sans-serif;
min-width: 778px;
max-width: 990px;
height: 1170px;
}
#lvTableWrapperOutside
{
position: relative;
}
#lvTableWrapperInside
{
width: 99%;
height: 420px;
overflow: auto;
font-size: small;
}
#lvTableWrapperInside #JOATable
{
border-collapse: separate;
border-top: none;
width: 98%;
/* IE Only */
#border-collapse: collapse;
}
#lvTableWrapperInside th
{
background-color: #000066;
color: White;
height: 30px;
text-align:center;
position: relative;
}
#lvTableWrapperInside tbody
{
overflow: auto;
height: 350px;
overflow-x: hidden;
}
#lvTableWrapperInside thead tr
{
/* IE Only */
#position:absolute;
#top ;
#left ;
}
#lvTableWrapperInside tr
{
height: 1px;
}
#lvTableWrapperInside th a:visited
{
color: White;
}
#lvTableWrapperInside th a:link
{
color: White;
}
<div class="ForumMod">modified on Wednesday, February 18, 2009 2:41 PM</div>
|
|
|
|
|
One more thing, padding required for outside div in IE so the first so many rows are not hidden by the header.
#lvTableWrapperOutside
{
position: relative;
#padding: 4em 0 2em 0;
}
|
|
|
|
|
Hi,
I have collection of records that means i have collection of value objects of same type. I transfered all the value objects into one custom collection,Now i want to convert this custom collection object into xml to store into the databse.
can anybody guide me how to convert custom collection object into xml object using c#.
Let us assume i have 10 records of employee type. Now i added all these 10 records into employ collection object. Now i want to convert this collection object into xml object.
|
|
|
|
|
Write a method in the employee class that emits XML describing it. Then iterate over your collection, and build your XML that way.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
What type of collection are you using? If the collection itself is serializable, you can mark your employee objects as serializable using the SerializableAttribute (or ISerializable , but that requires more work), and then simply serialize the collection. You can also make use of data contracts and use the data contract serializer. The only drawback to these options (except implementing ISerailzable) is that you don't really have much control over the generated XML.
The other option would be to follow Christian's solution and implement some sort of ToXml() \FromXml() pair of functions that then generate and consume custom generated XML. From there you would want to add a similar set of methods to your collection in order to serialize the list of objects.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
hi,
i am transferring my table to excel from asp.net
the code is as follows.
Dim i As Integer
Dim s As String
s = " "
For i = 0 To 100
s = s & " "
Next
Dim attachment As String
attachment = "sameer.xlsx"
Response.AddHeader("content-disposition", attachment)
Response.ContentType = "application/vnd.ms-excel"
Response.Write(" nbsp; ")
Response.Write("sameer")
Response.Write("roy")
Response.Write("<table style='z-index: 101; left: 789px; position: absolute; top: 19px' border="2"><tr><td>sameer</td></tr></table>")
Response.End
Now the problem is that when im executing the dispaly in browser the table shows at the required location.However when im streaming the table into excel file it is starting from the extreme left corner .i Tried this one
Response.Write(" " & "<table style="z-index: 101; left: 789px; position: absolute; top: 19px" border="2"><tr><td>sameer</td></tr></table>")
however it didnt work.
Any help is greatly appreciated
<div class="ForumMod">modified on Friday, February 13, 2009 12:51 PM</div>
|
|
|
|
|
In the master page code behind I would like to know what the current page is.
System.Web.HttpContext.Current.Request.Url.AbsolutePath does not return the correct value when called from the master page.
|
|
|
|
|
It actually works for me. What value were you expecting and what did you get?
|
|
|
|
|
try with:
System.Web.HttpContext.Current.Request.FilePath
|
|
|
|
|
Hi All,
How i can used File Upload Control and i limit user to enter any text in this control and only browse in her/him files?
Thank You,
Hoda
modified on Friday, February 13, 2009 12:45 PM
|
|
|
|
|
just use a FileUpload control and block the keypress JS event handler
onkeypress=”javascript: return false;”
FileUpload1.Attributes.Add("onkeypress","javascript: return false;");
Calin
|
|
|
|
|
Hello!
I´ve used asp:panel for rendering divs I need to manage from code-behind. I recently heard asp:panel can render into table on some browsers. Is this true, and which browsers would that be?
modified on Friday, February 13, 2009 8:56 AM
|
|
|
|
|
livez wrote: I recently heard asp:panel can render into table on some browsers. Is this true,
All Server side control rendered to HTML Control.
|
|
|
|
|
yes of course, but I was under the impression asp:panel rendered into div.
|
|
|
|
|
|
Thanks for your reply!
Guess I´m just gonna use divs with runat=server instead.
|
|
|
|
|
How can we open the Popup window while clicking SWF Object. Is it Possible. I want to open a popup window while clicking an embeded object.
|
|
|
|
|
|
Hello
i want searching code in database
mu application in id, name ,city three fields in one table from database
but user input name or id or city (any one)at that time give result
plz give me code thanx.,.,
|
|
|
|
|
hi JAS
I dont know where to start , because i dont know how much you know about what you just asked, but from the Info you gave i assume you want to search your table based on ID or City and return a something like Zipp code, well in my Country we call that postal code. So that can be done the First thing you have to create a Stored Procedure that that will do that for you like this
CREATE PROC PRCGETCODE
(
@CITY INT,
@CITY_CODE INT OUTPUT
)
SET @CITY_CODE(SELECT TOP 1 CODE FROM WHERE CITY = @CITY)
............
............. RETURN A CODE OR ZERO, TO GET RID OF NULLS
...............
and in your C# code do something like this
con = new SqlConnection(constring);
cmdselect = new SqlCommand();
cmdselect.CommandText = "DBO.PRCGETCODE";
cmdselect.CommandTimeout = 0;
cmdselect.CommandType = CommandType.StoredProcedure;
cmdselect.Connection = con;
int City_Code= 0;
try
{
con.Open();
City_Code = cmdselect.ExecuteNonQuery();
}
catch (SqlException)
{
throw;
}
finally
{
con.Close();
}
return City_Code;
}
and later you bind your result to a control, hopefull not Gridview , because this is one value lol!!!!!!!!
Hope i helped
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
www.ITS.co.za
|
|
|
|