|
Interesting links. I'll look into them.
Thanks Michael
|
|
|
|
|
Hi All,
I want to bind a list box with three columns from a table.
Could you please advice.
Thanks
|
|
|
|
|
Why do you wanna use "Listbox" instead of "GridView"?
|
|
|
|
|
Is Gridview of ASP.NET 2.0 is equivalent of Datagrid 1.1
Thnx in Advance
|
|
|
|
|
GridView has more advanced features than DataGrid.
Please read this article for comparing GridView and DataGrid (GridView Vs DataGrid).
|
|
|
|
|
Hello Everyone,
Can anybody let me know to through focus/cursor blinking on a text box as
the page get loaded.
i'm using the following command given below as i use in ASP.NET with 1.1
and this piece of code run fine in ASP.NET 1.1 but generating error in ASP.NET 2.0
function myFocus()
{
document.form1.txtName.focus();
}
ERROR:- myFocus() not found
|
|
|
|
|
You are writing this code in Single aspx page or Master page or content page or what?
What you can do is that you can view the sourcecode in browser and find out whether this function still there or not...
|
|
|
|
|
Hi Everybody
.aspx page I used DetailsView and GridView. GridView has three Columns ErrorID, ErrorType and ErrorDate. If I click on ErrorID then DetailsView will show the whole information (Same Page GridView then DetailsView)
Here is my code which is binding GridView1
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim _AuditLog As AuditLog = New AuditLog()
_AuditLog = CType(e.Row.DataItem, AuditLog)
If (_AuditLog Is Nothing) Then
Else
Dim lblErrorID As Label = e.Row.FindControl("lblErrorID")
Dim lblErrorType As Label = e.Row.FindControl("lblErrorType")
Dim lblErrordate As Label = e.Row.FindControl("lblErrorDate")
lblErrorID.Text = _AuditLog.ErrorID.ToString()
lblErrorType.Text = _AuditLog.ErrorType.ToString()
lblErrordate.Text = _AuditLog.DateStamp.ToString()
End If
End Sub
Now wot should be code for DetailsView. I dont want to write any code inside .aspx file, it will be .vb or .cs
Any help will be greatful for me
Sarfarj Ahmed
|
|
|
|
|
|
Hi,
In my project, there is a web service(that acts as business layer), which fetches data from the datalayer(ie class library). when i try to populate data to a grid control in my windows form, nothing happens, ie no data is populated & no error is fired. i am accessing the project from my local network via VSS. when i try to run the web service by using IE, it shows the warning The test form is only available for requests from the local machine...
will anybody help me to get out of this..
thanks in advance
Sebastian
|
|
|
|
|
|
Thank you, I have tried the first method listed here, and that doesn't help me. i receive the same message..
sebastian
|
|
|
|
|
Can someone tell me if this is possible please. I have created a web based reporting application for my boss and he wants the option to export the tables that get shown to a .csv file. Seems reasonable except I am pretty sure that as it's web based I can only write back to the server...is this true? If not what do I do to save the .csv on his local machine? I was thinking that maybe I can save it on the server then try and open it on via the browser so the standard download attatchment window comes up? is there a set/standard or best practice way of doing this?
Thanks in advance for any help.
Ian
|
|
|
|
|
|
So having a quick glance thru that article and the code for it, that just writes a csv string to the browser. I can do that already, I can parse the table to a csv stream no probs.
My question and what I am more interested in knowing about is how I can export a .csv file from the datatable to a file through a button click on the browser...do i have to save the csv on the server? or can i save it straight to a user specified location on the local machine? I was thinking that if it wasn't possible to save to the user's local machine do I save it to the server with a unique name then try and open the file from the server? Is that the best way of doing things? or is there a reccomended best practive for this? Thanks for taking the time to help.
Cheers
Ian
|
|
|
|
|
Check into placing the results in a stream.
|
|
|
|
|
yeah I can do all that I can put the csv file using streamwriter...i just need to know where to put the file that streamwriter creates and how do i access it!
At the moment I am attempting to place the file on the server and then redirect the browser to the file name. This isn't working for me yet however, and I am not sure that this is even the best way to do it. I was asking which is the best way.
Here is my code, so you can see where I am currently coming from, it don't work like but it should give you an idea as to where i am coming from. But don't forget I am enquiring about best practices here, not how to fix this specific bit of code.
Protected Sub btExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btExport.Click<br />
<br />
Dim datTable As DataTable = gvReport.DataSource<br />
<br />
' Create a directory for the file to be stored on the server<br />
' Check whether a directory exists in the first place. If not create it.<br />
If Not Directory.Exists(Server.MapPath("CSV")) Then<br />
Directory.CreateDirectory(Server.MapPath("CSV"))<br />
End If<br />
<br />
' Create a unique identifier.<br />
Dim strFileName As String<br />
strFileName = Server.MapPath("CSV") & "\" & GetTempName()<br />
<br />
Dim objStreamWriter As StreamWriter<br />
objStreamWriter = File.AppendText(strFileName)<br />
' Code to write the csv file to the writer.<br />
objStreamWriter.Close()<br />
End Sub
Cheers
Ian
|
|
|
|
|
Here's the way I've seen it done before (no idea if it's best practice - but what the hey! )
When the user clicks the button, have the database export to a temporary .csv somewhere on the server (that the user will be able to access). Then do a response.redirect as the return of the page postback giving the url of the newly created temporary file. Hey presto, the user should be presented with a file download dialog.
There's bound to be a few gotchas, the one that springs readily to my mind is that you must make sure to purge that temp directory on a frequent basis, or you'll enter a world of pain!
|
|
|
|
|
Thanks thats the way I have implemented it now. I perform the purge whenever the application start method runs. The Server is shutdown at the end of each working day so it should purge once a day. Its a right bit of a bugger tho. Esp as I haven't been able to figure out as to when the application object is created if the path of the calling webform isn't in the root then it has the potential to create CSV directories allover the shop :-S I am using MapPath to get the Path name and it just picks up the current location. nightmare! lol I am sure is will come up with something tho
Cheers
For everyone's help esp Martin!
Ian
|
|
|
|
|
how can v write html tags in asp.net +c# code??
|
|
|
|
|
you can write all your html code in a stringbuilder if you want to!
Gautham
|
|
|
|
|
Do you mean something like this ? Response.Write("<h1>This is HTML heading tag</h1>")
-- modified at 9:19 Wednesday 11th July, 2007
|
|
|
|
|
can i write the html tags in defaultpage.aspx.css???
|
|
|
|
|
regimol wrote: can i write the html tags in defaultpage.aspx.css???
Yes. You can append all your HTML tags in a string and write it to the response. Or put one literal control and assign this string to there
|
|
|
|
|
regimol wrote: defaultpage.aspx.css
.CSS indicates Cascading Style Sheet.
.CS indicates CSharp
|
|
|
|