|
Sure,
and just to complement Graus sugestion, you can get that variable in your URL using a Javascript QueryString method (search for it) in the onload event of your page`s body.
|
|
|
|
|
How can we use web parts as in like >> have a look at this site
http://www.pageflakes.com (asp.net 2.0 )
|
|
|
|
|
|
Hi
ALL of you.
i use view state for sorting code is given but problem
is that it sorts perfectly on name but not on date ..
What to do????
actually i chage the date into varchar in order to display in drid
For Ex it shows 01 Feb 2007 in Grid but when i click on header it
dont sort in correct way..
<br />
<br />
Bind();<br />
oColumnCollection=dgHistory.Columns;<br />
if(ViewState["SortOrder"].ToString() == "" || ViewState["SortOrder"].ToString() == "DESC")<br />
{<br />
dv.Sort = e.SortExpression;<br />
<br />
ViewState["SortExpression"]= e.SortExpression + "ASC";<br />
ViewState["SortOrder"] = "ASC";<br />
}<br />
else<br />
{ <br />
dv.Sort = e.SortExpression + " DESC";<br />
<br />
ViewState["SortExpression"]= e.SortExpression + " DESC";<br />
ViewState["SortOrder"] = "DESC";<br />
}<br />
<br />
dgHistory.DataBind();<br />
Thanks
|
|
|
|
|
For date sorting, you have to use some different logic, especially date sorting is the best one. But, here you are using just string sorting, so you won't get correct result.
So, use date field in the dataview instead of changing into varchar (that is best way), and use format to display the date into the specified format. You can use the DataFormatString property in grid.
For example: for bound column,
....asp:BoundColumn DataField="FieldName" DataFormatString="{0:dd MMM yyyy}" .....
I hope, you can get the answer from this.
Regards
R.Arockiapathinathan
|
|
|
|
|
Hi,
Do not covnert you date column to varchar but set the DataFormatString property of the column in which you are displaying the date value.
Design Time
<asp:BoundColumn DataField="colName" DataFormatString = "{0:dd-MMM-yyyy}"></asp:BoundColumn>
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Hi, can anyone tell where i can donwnload free ASP richtextbox?
Thank
................
|
|
|
|
|
|
|
Hi All..
I have a datagrid holding values in it..I have a button below that datagrid(print button)..If i click the print button the datagrid values should be sent to the printer and the print out must be taken..I have the datagrid in as .aspx page(ASP .NET)..Someone help in this regard with the code..
Regards,
Balaguru
|
|
|
|
|
Balagurunathan S wrote: If i click the print button the datagrid values should be sent to the printer and the print out must be taken
Create one more empty page with this datagrid. Then on the body onload event write window.print. It will open printer dialog
|
|
|
|
|
Plenty of informations is available in the net.
Just google it.
"Printing DataGrid in ASP.NET"
Regards,
Arun Kumar.A
|
|
|
|
|
Have you seen the Article by Russ Quinn in CP.
Print Datagrid in Asp.Net[^]
This article will be very helpful for developing your printing options in a Datagrid in Asp.net
Regards,
Satips.
|
|
|
|
|
Hi
I am a long time powerbuilder developer who has recently started a new job working with asp.net and vb. I am currently using a grid view to display a list of users. I need to be able to delete an unused user from the table. ie one that has had nothing in the referenced table assigned to him. I have set up the auto command button thingy to delete the user in the current row My database works ace with the constraints set up correctly. If I attempt to delete a user that has been referenced elsewhere I get a lovely asp error page saying that it fails the constraint check, and if he hasn't been referenced anywhere he gets deleted. However I want to be able to handle the error so that I get something more meaningful for the user. I have thought about two ways of doing this, and I am a bit stuck on getting either way to work.
The first way I thought of was to place in the rowdeleting event of the gridview a check to say if there exists in the referenced table an instance of the userID then cancel the event using e.cancel(). This would work ace except that I can't for the life of me find the command to reference which row is clicked. Also this means another call to the database which prob isn't so great.
The other way I thought of would be to catch the constraint exception coming from the database. However I can't find where to put this. I mean I assume its a try catch somewhere, but there is no event for the delete being run, its either rowdeleting or rowdeleted. So not sure of the way this should be handled, any help would be most appreciated. I realise this is prob a trivial explanation but there doesn't seem to be a lot of info about it around.
Cheers
Ian Caddick
-- modified at 8:38 Wednesday 25th April, 2007
Ok then think I have managed to solve the problem I have used option one and found out how to return to the row number clicked. It might have seemed like a bit of a trivial option but after much faffing around with dictionary things discovered the datakey object! Why oh why is there not a lot of help around the net on this? This is what I came up with in the end...
<br />
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting<br />
<br />
Dim index = Integer.Parse(e.RowIndex)<br />
Dim dk As DataKey<br />
<br />
dk = GridView1.DataKeys.Item(index)<br />
<br />
Dim iOpID = dk.Value<br />
<br />
' Check if the User Can be deleted if he can enable the delete button.<br />
Dim connectionString = sqlSubSystem.ConnectionString<br />
Dim SqlConnection As SqlConnection<br />
SqlConnection = New SqlConnection(connectionString)<br />
Dim Command As SqlCommand<br />
<br />
Dim queryString As String = "SELECT count(subsystemID) FROM dbo.supportcall where [subsystemID] = " & iOpID.ToString()<br />
Command = New SqlCommand(queryString, SqlConnection)<br />
<br />
SqlConnection.Open()<br />
Dim i<br />
i = Command.ExecuteScalar()<br />
SqlConnection.Dispose()<br />
Command.Dispose()<br />
<br />
If i > 0 Then<br />
lblError.Text = "Cannot Delete as Subsystem already in use."<br />
lblError.Visible = True<br />
e.Cancel = True<br />
Else<br />
<br />
End If<br />
<br />
<br />
End Sub
I would still like to know how to do it by catching the constraints exception tho, if anyone can shed any light on that.
Cheers
Cads
|
|
|
|
|
Hi,
I have downloaded the ASP.NET AJAX V1.0 and AJAX Control Tool Kit zip file & Installed the ASP.NET AJAX V1.0 successfully.
How can I Install the AJAX Control Tool Kit? Please help me.
Note: I can't able to view the video in ajax.asp.net website now. (Media player usage was blocked in my office).
Regards,
Jay
|
|
|
|
|
There's no need to install it - just reference the dll in your project.
|
|
|
|
|
Pl. Tell me in steps.
AjaxControlToolkit.zip (runtime binary, 3378K). I have unzipped it. In Binaries folder, I found 3 DLL files.
I have created a new tab in the tool bar. Than, right click, Choose Items --> Browse --> Tools.dll. It gives some error message.
Pls help me.
Regards,
Jay
|
|
|
|
|
Use the AjaxControlToolkit.dll located in SampleWebSite\Bin of the zip file. Seems if this is built in debug mode, so if you need a release version just open the AjaxControlToolkit project (AjaxControlToolkit.csproj) and build it yourself. Then use the dll output.
|
|
|
|
|
Thanks. It works fine.
Regards,
Jay
|
|
|
|
|
Hi, plz answer this. I know the purpose of viewstate but many suggests not to use. Then why is this feature in .net
thanx
|
|
|
|
|
You can comfortably use viewstate, only thing you need to keep in mind is you can disable if it is not required.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
ViewState is used to keep the Value in a web page between postback throughout the Page's life cycle. If we store the large objects in ViewSate, it will affect the performace of the web page.
Regards,
Jay
|
|
|
|
|
hello
actually it depends on person how the person use features .as if you need only a hyperlink then you should use html anhor tag instead of <asp:hyperlink>
so depends where you need which control on your deep thinking means .it works for code optimisation.
....ok
gs
gs
|
|
|
|
|
hi..
ya view state stores page controls information during each request to server.so its very importanat in .net.
assume u have filled up form and u pressed submit and lossing all filled in data when u get reply from server saying u have entered error in some field.....cant dream of it right so view state helps us here.
and the case is view state makes the page heavy for processing so if u are enabling view state uncessaryly for all controls which may not be not always required then u are making server processes heavy pages which is load on server and reduces performance ....
..i think u got it now right??rate it if u like..
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
Thanx. Your information is useful.
|
|
|
|