|
DateTime dt;
if(DateTime.TryParse(reportDate, out dt))
{
dv.RowFilter = string.Format("Date='{0}'", dt);
}
or the overload
if(DateTime.TryParse(reportDate, IFormatProvider, Style, out dt))
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
If you don't care about the time portion use this
<br />
dv.RowFilter = string.Format( "Date='{0}'", reportdate.ToString("dd/MM/yyyy");<br />
|
|
|
|
|
still i could not solve it.
i am getting the following error when i am trying this..
dv.RowFilter = string.Format("Date='{0}'", reportdate.ToString("dd/MM/yyyy"));
The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments
|
|
|
|
|
Sorry, I didn't realize that you were using the string value. To use the string, use
<br />
dv.RowFilter = string.Format("Date='{0}'", Convert.ToDateTime(reportdate).ToString("dd/MM/yyyy"));<br />
|
|
|
|
|
hi,
my html look good in IE but it look odd in firefox but i can not understand the reason.i work with checklistbox.so i am giving my html snippet below. please anyone check it and tell me why it is looking bad or cluttered in Firefox.how to make it compatible for all the browser.
html
<TABLE id="Table4" cellSpacing="1" cellPadding="1" width="58%" bgColor="#d8e4f8" border="0">
<TR><TD vAlign="top" noWrap width="10%"><span id="Label2" style="font-weight:bold;">Date</span>
<input name="txtDate" type="text" readonly="readonly" id="txtDate" style="border-style:Groove;" /></TD>
<TD vAlign="middle" noWrap width="7%"> <span id="Label3" style="font-weight:bold;">Country</span></TD>
<TD vAlign="top" width="36%"><table id="chkCountry" border="0" style="font-weight:bold;width:100%;">
<tr><td><input id="chkCountry_0" type="checkbox" name="chkCountry " /><label
for="chkCountry_0">UK</label></td><td><input id="chkCountry_1" type="checkbox" name="chkCountry:1" /><label
for="chkCountry_1">USA</label></td><td><input id="chkCountry_2" type="checkbox" name="chkCountry:2" /><label
for="chkCountry_2">Germany</label></td><td><input id="chkCountry_3" type="checkbox" name="chkCountry:3" /><label
for="chkCountry_3">France</label></td><td><input id="chkCountry_4" type="checkbox" name="chkCountry:4" /><label
for="chkCountry_4">Italy</label></td><td><input id="chkCountry_5" type="checkbox" name="chkCountry:5" /><label
for="chkCountry_5">Canada</label></td><td><input id="chkCountry_6" type="checkbox" name="chkCountry:6" /><label
for="chkCountry_6">Netherlands</label></td>
</tr></table></TD><TD vAlign="top" width="5%"><button language="javascript" onclick="setTimeout('javascript:IsBusy(1);',50);
__doPostBack('btnGo','')" id="btnGo" type="button" value="GO"></button></TD>
</TR><TR><TD vAlign="top" noWrap width="10%"></TD><TD vAlign="middle" noWrap width="7%"></TD><TD vAlign="top" align="right" width="36%">
<a id="HyperLink1" href="EODMain.aspx">Main Menu</a></TD><TD vAlign="top" width="5%"></TD></TR></TABLE>
tbhattacharjee
|
|
|
|
|
There is a tool firebug install it in your browser, and with help of that you will be able to know what is the exact problem..
|
|
|
|
|
Tridip Bhattacharjee wrote: .how to make it compatible for all the browser.
You need to work on CSS. Need to create different css class insted of giving direct value in aspx page.
|
|
|
|
|
Use This code Solve ur prob..
<table cellspacing="1" cellpadding="1" bgcolor="#d8e4f8"
border="0">
<tr>
<td valign="top" nowrap >
<span id="Label2" style="font-weight: bold;">Date</span>
<input name="txtDate" type="text" readonly="readonly" id="txtDate" style="border-style: Groove;" /></td>
<td valign="middle" nowrap >
<span id="Label3" style="font-weight: bold;">Country</span></td>
<td valign="top">
<table id="chkCountry" border="0" style="font-weight: bold; ">
<tr>
<td>
<input id="chkCountry_0" type="checkbox" name="chkCountry:0" /><label for="chkCountry_0">UK</label></td>
<td>
<input id="chkCountry_1" type="checkbox" name="chkCountry:1" /><label for="chkCountry_1">USA</label></td>
<td>
<input id="chkCountry_2" type="checkbox" name="chkCountry:2" /><label for="chkCountry_2">Germany</label></td>
<td>
<input id="chkCountry_3" type="checkbox" name="chkCountry:3" /><label for="chkCountry_3">France</label></td>
<td>
<input id="chkCountry_4" type="checkbox" name="chkCountry:4" /><label for="chkCountry_4">Italy</label></td>
<td>
<input id="chkCountry_5" type="checkbox" name="chkCountry:5" /><label for="chkCountry_5">Canada</label></td>
<td>
<input id="chkCountry_6" type="checkbox" name="chkCountry:6" /><label for="chkCountry_6">Netherlands</label></td>
</tr>
</table>
</td>
<td valign="top" >
<button language="javascript" onclick="setTimeout('javascript:IsBusy(1);',50);
__doPostBack('btnGo','')" id="btnGo" type="button" value="GO">
</button>
</td>
</tr>
<tr>
<td valign="top">
</td>
<td valign="middle" >
</td>
<td valign="top" align="right" >
<a id="HyperLink1" href="EODMain.aspx">Main Menu</a></td>
<td valign="top" >
</td>
</tr>
</table>
Hope this will help!
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
thanks it works but u did not explain what u add or rectify. plzzz mention.
thanks a lot.
tbhattacharjee
|
|
|
|
|
I have a datalist and now i want to give custome paging to that datalist using multiple active result set. I mean i want to show paging as
first,previous,1 2 3. . . next, last.
In this I want to get only 3 pages at a time. and once i got the page, I want to put it in caching and again if user click on that page number then i dont want
to get the data from cache instead of hitting the database.pls its urgent.pls help me.
Happy
|
|
|
|
|
hi , iam using asp.net with c#
iam displaying images using Handler.ashx but when there is no image present in a database i want to display nopic.jpg picture
can you correct my code which helps me
using System;
using System.Web;
using System.IO;
using System.Data;
using System.Data.SqlClient;
public class left1old : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
int branchid = 0;
if (context.Session["branchid"] != null)
branchid = Convert.ToInt32(context.Session["branchid"]);
else
throw new ArgumentException("No parameter specified");
context.Response.ContentType = "image/jpeg";
Stream strm = ShowImage(branchid);
byte[] buffer = new byte[4096];
int byteSeq = strm.Read(buffer, 0, 4096);
while (byteSeq > 0)
{
context.Response.OutputStream.Write(buffer, 0, byteSeq);
byteSeq = strm.Read(buffer, 0, 4096);
}
}
public Stream ShowImage(int branchid)
{
SqlConnection con = new SqlConnection(" Data Source=.; Initial Catalog=SafaView;User ID=sa;Password=nsg_ss_0103;");
string sql = "SELECT imgleft1old FROM tblImages WHERE BranchId = @branchid";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@BranchId", branchid);
con.Open();
object img = cmd.ExecuteScalar();
try
{
return new MemoryStream((byte[])img);
}
catch
{
return System.IO.Stream("~/images/NoPic.jpg");
}
finally
{
con.Close();
}
}
public bool IsReusable {
get {
return false;
}
}
}
in page load
=============
protected void Page_Load(object sender, EventArgs e)
{int i=0;
i= Convert.ToInt32(Session["branchid"]);
if (IsPostBack == false)
{
Image1.ImageUrl = "left1.ashx?BranchId=" + i;
Image2.ImageUrl = "left1old.ashx?BranchId=" + i;
}
can you correct my code which helps me
|
|
|
|
|
Why tyou are using try catch, it is performance overhead, its better you return the nopic image from db itself, put it in some common table, if there is noimage for that record return nopic image, also you can read as you are doing, just check if there is nothing in image read it from localdrive and send it in the same format.
try to debug the code you'll get to know the exact problem
|
|
|
|
|
What u can do is keep a blank image in ur websites image folder and just check
MemoryStream strm = new MemoryStream((byte[])img);
if (strm.Length <= 0)
{
//Then load the blank image
}
Tej Aj,
http://opexsolution.com/forum/[^]
|
|
|
|
|
I can see a couple of issues with the code:
developerit wrote: return System.IO.Stream("~/images/NoPic.jpg");
Should this be:
return new System.IO.Stream(Server.MapPath("~/images/NoPic.jpg"));
It would help if you could tell us what the error is that you're seeing...
|
|
|
|
|
Hi,
I want to redirect my webpage to another form which has a loading progress bar and want to pause there for few sec and then redirect to other page...
How to implemnt this in asp.net...
Pls help
Thanks,
|
|
|
|
|
seemadas wrote: I want to redirect my webpage to another form which has a loading progress bar and want to pause there for few sec
Pause for what ? For showing the progress bar or after pause you want to show the progress bar ?
|
|
|
|
|
Pause for showing the page which has Lpading bar....
|
|
|
|
|
Better to have a div with a progressbar image, show it from javascript when your page starts loading and hide it after the page got loaded, even you dont need to hide it because after gettting the response from server it'll overridden..
|
|
|
|
|
When i used to upload the excel file, i inserts the records but it used to skip the insertion, like my file has 9000 records it insert 8890 or 8800 sometimes 8950, plz suggest what would be the possible reason.
Dim conexcel As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("upload/" & FileUpload1.FileName) & "; Extended Properties=Excel 8.0")
Dim cmd As New OleDbCommand("select * from [Sheet1$]", conexcel)
Try
If ConnectionState.Open Then
conexcel.Close()
End If
conexcel.Open()
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader()
Dim act, cnt, ds, cf, co, distt, dtype As String
act = ddl_Activity.SelectedItem.Text.ToString()
cnt = ddl_Center.SelectedItem.Text.ToString()
ds = ddl_DataSource.SelectedItem.Text.ToString()
distt = ddl_Distt.SelectedItem.Text.ToString()
bcode = UCase(bcode) & "/" & distt & "/" & act & "/" & bno.ToString()
dtype = ddl_DataType.SelectedItem.Text.ToString()
Try
Dim name, cnt1, cnt2 As String
name = ""
cnt1 = ""
cnt2 = ""
cf = ""
co = ""
Dim m, p As Int64
m = 1
While (dr.Read())
name = Trim(dr(0).ToString())
cnt1 = Trim(dr(1).ToString())
cnt2 = Trim(dr(2).ToString())
cf = Trim(dr(3).ToString())
co = Trim(dr(4).ToString())
Dim str As String
If cnt1 <> "" Or name <> "" Then
str = "insert into tbl_edu_dt(full_name,contact1,contact2,Activity,Center,DistName,DataSource,Collected_From,Collected_On,batch_code,batch_id,imp_date,imp_time,Data_Type) values ('" & name & "','" & cnt1 & "','" & cnt2 & "','" & act & "','" & cnt & "','" & distt & "','" & ds & "','" & cf & "' , '" & co & "','" & bcode & "','" & m & "','" & Format(Now(), "dd/MM/yyyy") & "','" & imp_time & "','" + dtype + "')"
ObjClass.execute_query(str)
m = m + 1
End If
End While
Catch ex As Exception
End Try
conexcel.Close()
File.Delete(Server.MapPath("~/Upload/" + FileUpload1.FileName))
Catch ex As Exception
Response.Write(ex)
End Try
|
|
|
|
|
If you don't check for any errors, you'll never know...
|
|
|
|
|
Its fine but i m not so free that i will post the problem without checking it. If u dont know the solution why give this kind of posts.
|
|
|
|
|
Looking at your code, you never check for an error after the insert statement. Chances are that you have some illegal values in your input records, and checking for errors would tell you the rows on which it happens.
Just stepping over the insert statement will bring you nothing.
|
|
|
|
|
yogesh_kumar_agarwal wrote: like my file has 9000 records it insert 8890 or 8800 sometimes 8950,
With the same file or multiple file ? I guess it may be causing of exception during the insert records.
What is my suggestion is, Just do a quick comparison with the insrted data and the orginal data. You will easily identify the records which are not inserted. Now check what goes those records.
Hope you got my point.
Thanks !
|
|
|
|
|
This happens in the same file, u overcome the problem i try it to do upload the records using code also with the bearkpoint at catch but it will never come over that.
Also when it inserts 8890 records then abviousally it inserts those records also that it skips when it inserts only 8800.
So i just can't undersatnd the problem why it skips the inserts.
Plz help!!
Thanks
Yogesh Agarwal
|
|
|
|
|
No, Here is my one doubt. You are saying you have 900 records in file and when you inserted the in DB the records comes to 890 ( Let Say ). So there is missing of 10 Recrods. Did you try to identify which records are not inserted ? If yes what is the different between the data which are inserted or which not ? Is there any problem with special char. with in the data ?
|
|
|
|