|
|
Hi all,
As per the requirement my machine language settings are set to Italian language.
while generating reports in my application i am facing a problem that
i have a column called timespent lets say eg: 1.5 units
We are showing the report in excel formate.
Note:- In Italian formate "1.5" should be display as "1,5"
------
I am applying following style to out put record set of "TIME_SPENT" but i am getting the out put '1.5 but required Output is "1,5"
sbrHTML.Append("<style>.timespend { mso-number-format:@;} .premium { mso-number-format:$\\#\\,\\#\\#0\\.00;} .ogDate {mso-ignore:padding;mso-generic-font-family:auto;mso-font-charset ;mso-number-format:yyyy-MM-dd;mso-background-source:auto;mso-pattern:auto;} </style>");
sbrHTML.Append("<td class=timeSpent>" + sqlDatareader["TIME_SPENT"].ToString() + "</td>");
out put:'1.5
Please can any can help on this.
Thanks in advance,
subbu.
|
|
|
|
|
Excel does not support decimal, which means it's exported as string instead.
Try converting to double before exporting. Or converting to string yourself using the correct locale before exporting.My postings are a natural product. The slight variations in spelling and grammar enhance their individual character and beauty and are in no way to be considered flaws or defects.
|
|
|
|
|
Thanks alot as per you suggestion i did its working fine.
Regards,
Subbu.
|
|
|
|
|
You're welcome My postings are a natural product. The slight variations in spelling and grammar enhance their individual character and beauty and are in no way to be considered flaws or defects.
|
|
|
|
|
Hi everyone,
I have the following web method as shown below. Can anyone tell me how can i call this web method in an asp.net webpage? The result that i want to obtain from calling this web method would redirect me to another web page. thanks in advance.
[WebMethod]
public int DoIT()
{
// Get the hostname
string myHost = System.Net.Dns.GetHostName();
string connect = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\\inetpub\\wwwroot\\Request\\App_Data\\TV.mdb";
string query = "SELECT COUNT(IPAddress) FROM Request WHERE IPAddress = ?";
int result = 0;
using (OleDbConnection conn = new OleDbConnection(connect))
{
using (OleDbCommand cmd = new OleDbCommand(query, conn))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("IPAddress", myHost);
conn.Open();
result = (int)cmd.ExecuteScalar();
}
}
return result;
}
|
|
|
|
|
If you want to call the WebService from the client then you can use ASP.NET AJAX for this, check this links:
http://www.asp.net/ajax/
http://www.asp.net/ajax/documentation/live/
http://www.asp.net/AJAX/Documentation/Live/tutorials/ASPNETAJAXWebServicesTutorials.aspx
|
|
|
|
|
Use AJAX PageMethods to access them.
|
|
|
|
|
Hi, I have an web application. I am lossing sessions and static variables become null if i use the following code in my application.
public string _xmlfilepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Code\\Culture.xml");
public string _userfilepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Users");
Even when i am using this code...the sessions are lost
_userfilepath = Request.PhysicalApplicationPath + "Users\\";
_xmlfilepath = Request.PhysicalApplicationPath + "App_Code\\Culture.xml";
If i use this code then its working fine.
Adding paths in web.config
<add key="UserPath" value="F:\MyFolder\Users\" />
<add key="CultureXML" value="F:\MyFolder\Admin\Culture.xml" />
Later i am retirving those paths in application
public string _userfilepath = ConfigurationManager.AppSettings["UserPath"];
public string _xmlfilepath = ConfigurationManager.AppSettings["CultureXML"];
But I dont know the drive names etc at client location to place my application. If i use the appdomain code then where ever this code placed the files will create in that directory itself. But the problem is i am loosing sessions and static variables becoming null. Due to this exceptions are arising.
How can i overcome this issue?G. Satish
|
|
|
|
|
|
Yes. I tried now by using Server.MapPath(). But still same problem loosing sessions and static variables becoming null. G. Satish
|
|
|
|
|
Dear Experts
I have gridview with bound with objectDatasource. I want to order by all the results with date. I can not see the property of objectdatasource that can order the result by date. I am waiting for your help please
My code is give as
<asp:ObjectDataSource id="odsCaseMovement" runat="server" OldValuesParameterFormatString="original_{0}"
TypeName="Atlas.Core.ObjectDataSource.odsV_CaseEnquiry" SelectMethod="odsLoadCaseByBarCode" OnSelected="odsCaseMovement_Selected">
<SelectParameters>
<asp:ControlParameter ControlID="txtCaseBarcode" Name="par_caseBarcode" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
The gridview is
<acc:AtlasGrid id="grvCaseMovement" runat="server" Width="98%" CssClass="GridTable" DataSourceID="odsCaseMovement" PageSize="20"
AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" OnRowDataBound="grvCaseMovement_RowDataBound">
<RowStyle CssClass="list_row" />
<PagerTemplate>
<div style="width: 100%; text-align: center;">
<asp:LinkButton CommandName="Page" CommandArgument="First" ID="LinkButton1" runat="server"
Style="color: black"><< First</asp:LinkButton>
<asp:LinkButton CommandName="Page" CommandArgument="Prev" ID="LinkButton2" runat="server"
Style="color: black">< Prev</asp:LinkButton>
[Records
<%= grvCaseMovement.PageIndex * grvCaseMovement.PageSize + 1%>
-
<%= grvCaseMovement.PageIndex * grvCaseMovement.PageSize + grvCaseMovement.Rows.Count%>
Of
<%= Atlas.Core.ObjectDataSource.odsV_CaseEnquiry.rowCount%>
]
<asp:LinkButton CommandName="Page" CommandArgument="Next" ID="LinkButton3" runat="server"
Style="color: black">Next ></asp:LinkButton>
<asp:LinkButton CommandName="Page" CommandArgument="Last" ID="LinkButton4" runat="server"
Style="color: black">Last >></asp:LinkButton>
</div>
</PagerTemplate>
<Columns>
<asp:BoundField DataField="ID" HeaderText="Case ID" Visible="False" />
<asp:BoundField DataField="Barcode" HeaderText="Case Barcode" SortExpression="Barcode" />
<asp:BoundField DataField="OriginalDate" HeaderText="Date Generated" SortExpression="OriginalDate" DataFormatString="{0:dd/MM/yyyy}" />
<asp:BoundField DataField="Date" HeaderText="Delivery Date" DataFormatString="{0:dd/MM/yyyy}" />
<asp:BoundField DataField="AccountName" HeaderText="Account Name" />
<asp:BoundField DataField="AccountNumber" HeaderText="Account Number" />
<asp:BoundField DataField="Loaded" HeaderText="Date & Time Loaded" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" />
<asp:BoundField DataField="POD" HeaderText="Date & Time Delivered" SortExpression="POD" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" />
<asp:BoundField DataField="State" HeaderText="Status" SortExpression="State" />
<asp:BoundField DataField="Name" HeaderText="Drop Point" SortExpression="Name" />
<asp:BoundField DataField="RouteNumber" HeaderText="Route Number" SortExpression="RouteNumber" />
<%--<asp:BoundField DataField="Returning" HeaderText="Job Type" SortExpression="Returning" /> --%>
<asp:TemplateField HeaderText="Job Type">
<ItemTemplate>
<asp:Label ID="lblJobType" runat="server" Text='<%# Eval("Returning")%>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Asset">
<ItemTemplate>
<asp:Label id="LabAsset" runat="server" Text='<%# Eval("AssetID") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="AssetType">
<ItemTemplate>
<asp:Label id="LabAssetType" runat="server" Text='<%# Eval("AssetTypeID") %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Warehouse Poistion" ItemStyle-Wrap="false" SortExpression="WarehousePosID">
<ItemTemplate>
<asp:Label ID="lblWarePos" runat="server" Text ='<%# Eval("WarehousePosID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="GridTablePagging" />
<HeaderStyle CssClass="GridTableHeader" />
</acc:AtlasGrid>
|
|
|
|
|
|
It is most like the code you refer.
But in my case sorting is working fine, As you have already noticed I am using AtlasGrid.
I want to load data sorted by DeliveryDate on PageLoad.
Thanks for you intrest in my problem
|
|
|
|
|
So why not just sort as: select [Column1], [Column2],... from [Table} order by [Column] in the underlying sql?Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
Actually I am using EasyObject and I do not have access to EasyObject Code and Database server. I have to order it by date in HTML code or code behind
|
|
|
|
|
<script language="javascript" type="text/javascript">
var dtCh = "/";
var minYear = 1900;
var maxYear = 2100;
function daysInFebruary(year) {
// February has 29 days in any year evenly divisible by four,
// EXCEPT for centurial years which are not also divisible by 400.
return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
for (var i = 1; i <= n; i++) {
this[i] = 31
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
if (i==2) {this[i] = 29}
}
return this
}
function stripCharsInBag(s, bag) {
var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++) {
var c = s.charAt(i);
if (bag.indexOf(c) == -1)
returnString += c;
}
return returnString;
}
function isInteger(s) {
var i;
for (i = 0; i < s.length; i++) {
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}
function isDate(dtStr) {
var daysInMonth = DaysArray(12)
var pos1 = dtStr.indexOf(dtCh)
var pos2 = dtStr.indexOf(dtCh, pos1+1)
var strMonth = dtStr.substring(0, pos1)
var strDay = dtStr.substring(pos1+1, pos2)
var strYear = dtStr.substring(pos2+1)
strYr = strYear
if (strDay.charAt(0) == "0" && strDay.length > 1) strDay = strDay.substring(1)
if (strMonth.charAt(0) == "0" && strMonth.length > 1) strMonth = strMonth.substring(1)
for (var i = 1; i <= 3; i++) {
if (strYr.charAt(0) == "0" && strYr.length > 1) strYr = strYr.substring(1)
}
month = parseInt(strMonth)
day = parseInt(strDay)
year = parseInt(strYr)
if (pos1 == -1 || pos2 == -1){
//alert("The date format should be : mm/dd/yyyy")
return false
}
if (strMonth.length < 1 || month < 1 || month > 12){
//alert("Please enter a valid month")
return false
}
if (strDay.length < 1 || day < 1 || day > 31 || (month == 2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
//alert("Please enter a valid day")
return false
}
if (strYear.length != 4 || year == 0 || year < minYear || year > maxYear){
//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
return false
}
if (dtStr.indexOf(dtCh,pos2+1)!= -1 || isInteger(stripCharsInBag(dtStr, dtCh)) == false){
//alert("Please enter a valid date")
return false
}
return true
}
function CheckDate(oSrc,args){
var fromDate = document.getElementById('TextBox1').value;
var toDate = document.getElementById('TextBox2').value;
if (isDate(fromDate) == true && isDate(toDate) == true){
var isvalid = 1;
var d1;
var d2;
d1 = fromDate;
d2 = toDate;
//Total time for one day
var one_day = 1000*60*60*24;
//Here we need to split the inputed dates to convert them into standard format
//for furter execution
var x = d1.split("/");
var y = d2.split("/");
//date format(Fullyear,month,date)
// var date1 = new Date(x[2], (x[0]-1), x[1]);
// var date2 = new Date(y[2], (y[0]-1), y[1]);
// var month1 = x[0]-1;
// var month2 = y[0]-1;
var date1 = new Date(x[2], (x[1]-1), x[0]);
var date2 = new Date(y[2], (y[1]-1), y[0]);
var month1 = x[1]-1;
var month2 = y[1]-1;
//Calculate difference between the two dates, and convert to days
diff = Math.ceil((date2.getTime()-date1.getTime())/(one_day));
if(diff < 0) {
isvalid = 0;
}
if(eval(isvalid) == 0) {
args.IsValid = false;
return;
}
else {
args.IsValid = true;
}
}
else {
args.IsValid = true;
}
}
</script>dhdh
|
|
|
|
|
So what's your question?Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
I am running .net 3.5 sp1
Where do I get the appropriate aspnet_regsql.exe please?
I ran the one in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 but it says it is not compatible.
This file does not exist in C:\WINDOWS\Microsoft.NET\Framework\v3.5
Any thoughts please?
|
|
|
|
|
arkiboys wrote: says it is not compatible.
What says it is not compatible? It doesn't matter what framework you are using aspnet_regsql.exe only creates the database for asp.net forms auth. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
It gives that error When I try to login to the site.
Thanks
|
|
|
|
|
Then it isn't with the aspnet_regsql. Check your connection string. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi
I am using a multiline textbox in asp.net.
I want if a url is entered in textbox then it should be clickable.
I have goggled but found no answer.
Please help me.
Thanks in advance
|
|
|
|
|
Off the top of my head I think you'd need to use a Rich Text Control of some description or, perhaps, FCK Editor (I would link it for you but I'm being blocked form Source Forge for an unkinown reason (me not them)). Anyway, look at those unless anyone has a better solution.Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
ASP.net doesn't have rich textbox control. It is in windows form.
|
|
|
|