|
Michael:
Thanks for the quick response. If I understand you correctly, what you are implying that I should do is something like the following. Let's say that a portion of my SelectCommand of the SqlDataSource looks like so (this is Oracle P-SQL):
"..... where EXTRACT( MONTH from mh.historydatetime) = :MONTH_ID"
Now, the bind-variable comes from the SelectedIndex of the drop down combo box. What you are saying to do, in essence is something like the following:
"..... where EXTRACT( MONTH from mh.historydatetime) = :MONTH_ID AND :TIMESTAMP_INFO = :SUBMIT_TIME"
That sounds quite difficult. For one: how do I put the timestamp info into a variable? Secondly, what is the logic behind this? As long as a different month is selected from the drop down, it should use the new data, right?
Regards,
Rob
|
|
|
|
|
Hi Everybody
On my project I have a gridview with a button. When someone click the button then new page will be open with those parameter which is related on gridview
Thanks
Sarfarj Ahmed
|
|
|
|
|
Sarfaraj Ahmed wrote: : Open New window with some parameter
<br />
window.open ("http://www.javascript-coder.com?par1=1&par2=2",<br />
"mywindow","menubar=1,resizable=1,width=350,height=250");
|
|
|
|
|
I'm confused.
I'm new to ASP.NET, but already have enough experience with plain old HTML/classic ASP to get by (I'm more of a C/C++ guy trying to expand my horizons).
I have page that performs some database operations, with an asp:label that shows the result either in green or red text to indicate success or failure. I've defined two CSS classes:
.clsMessageSuccess<br />
{<br />
color: Green;<br />
}<br />
.clsMessageFailure<br />
{<br />
color: Red;<br />
}
Then at runtime, depending on the result of the database operation, I change my label's CssClass property to either clsMessageSuccess or clsMessageFailure. Works great.
Now I'm trying to revisit this and do things "the ASP.NET way" using themes and skins. I've defined the following in my .skin file:
<asp:Label runat="server" SkinID="sknResultLabelSuccess" ForeColor="Green" /><br />
<asp:Label runat="server" SkinID="sknResultLabelFailure" ForeColor="Red" />
I thought I'd simply be able to replace my label's SkinID property at runtime like I'm currently doing for CssClass. No such luck:
"The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection."
Great. I could understand why, and it looks my approach is plain wrong, but what I don't understand then is how it should be done "properly". I could just forget about the whole skins idead and just change the label's ForeColor property instead of its SkinID (which apparently isn't allowed), but this goes against the very nature of code/styling separation. What if I also wanted to make the text bold? I'm not going to start changing multiple properties every place I'm currently trying to replace the SkinID.
Why not stick with replacing CssStyle? Because my master page uses one .css file, and it's getting quite long. It contains different sections that are only used by specific pages. I want to break that out into multiple .css files and *only* include the required files in the pages that need them. However, the master page is the one containing the head tag (and closes it), so I can't include additional .css files in other aspx files (or if I can, I haven't found out how). Traditionally, in classic ASP, I've been able to include multiple css files without any issue (eg, I have one basic css file that applies to all pages--which I've now put in the master page--and other files that apply only to the page in question). What's the proper way to do this in ASP.NET?
I'm starting to dislike the way ASP.NET does some things. Themes/skin files sound great in theory, but then looking at the HTML generated, I see it takes the attributes defined in skin files and applying them directly as style attributes to individual controls. Awesome. So CSS files made us take styling out of the HTML, but then skins adds them back?
-- modified at 10:24 Wednesday 11th July, 2007
|
|
|
|
|
|
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??
|
|
|
|