|
Here it is ..
In Calendar1_DayRender event just use the following code.
if(e.Day.IsWeekend)
e.Day.IsSelectable=false;
|
|
|
|
|
When designing classes is it a best practice to do exception handling within class or should it be taken care of at the UI level?
In other words if my class is in ClassLibrary project should I check and throw exceptions there like this:
public MyClass
{
public MyClass(){...}
GetSomeDataById(string id)
{
try
{
...
}
Catch
{ }
finallay
{
}
}
}
--------------------------------------------------------------
MyClass myClass = new MyClass("whatever");
string someData = myClass.GetSomeDataGyId("10");
if(String.IsNullOrEmply(someData)
{
}
or should I do something like this:
public MyClass
{
public MyClass(){...}
GetSomeDataById(string id)
{
....
}
}
-------------------------------------------------
try
{
MyClass myClass = new MyClass("whatever");
string someData = myClass.GetSomeDataGyId("10");
if(String.IsNullOrEmply(someData)
{
}
}
catch Exception(e)
{
}
|
|
|
|
|
If you are using the class from more than one location and the messages might be different for different locations then you should throw the exception from the class.
You should log the exact location of exception in log file so that you must know the origin of the exception.
I hope it will solve your problem.
Good luck.
|
|
|
|
|
I am looking for some good reference material, sample code for GridView/Sqldatasource with CODE BEHIND model. I need to do SELECT, INSERT,UPDATE and Delete operations on DataGridView.
I am comfortable with inline GrdidataView/SQLDatasource.
I would appreciate your help/inputs
Thanks
Amit
|
|
|
|
|
|
I recently upgrade to .Net 2005 and am utilizing the CrystalReportViewer control in my asp.net web application. I am able to run the report and display it, however the icons to print and export do not appear. They simply get the "red x" when it can't find the image? When I click on the export or print area, it does not work and returns "error on page".
Could anybody help me with this?
Thanks
|
|
|
|
|
Create a virtual directory "CrystalReportWebFormViewer2" under your web site and point it out to "C:\Program Files\Microsoft Visual Studio .NET 2003\Crystal Reports\Viewers\" or corresponding path of VS 2005
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
I ran into some problems on a particular page in an application. Only on that page, for the same control that worked in other pages, the RaisePostbackEvent was not being called, even if the “__EVENTTARGET” value from the post collection was the same as the UniqueID of my control.
After a while i discovered that the event was raised but for another control in the page.
I read the msdn documentation on the event but it was kind of blurry about was really going on with the RaisePostbackEvent.
My general idea was:
-a control implements IPostBackEventHandler
-it makes sure there is a key in the posted date equal to it's UniqueID (msdn documentation)
-the postback is performed with the “__EVENTTARGET” = UniqueID
( Page.ClientScript.GetPostBackEventReference(Me, ""))
So, i thought, that in the case the conditions described above were met the control would have it's RaisePostbackEvent called. This doesn't seem to be the case in my case. So i have tried to find the problem.
I got confused reading some articles that suggested that: “Your control needs the call to RegisterRequiresRaiseEvent when it implements both IPostBackDataHandler and IpostBackEventHandler. Otherwise, the page will not invoke the RaisePostBackEvent method of your control in the Raise Postback Event phase” - Developing ASP.NEt Server Controls and Components (MSDN press) http://www.thescripts.com/forum/thread306546.html.
This still didn't seam right, from my experiences this worked (in ASP.NET 1.1 and 2.0) you could implement both interfaces and the RaisePostbackEvent will still be called. In the book the example was for button control (a sumbit button) and i belive that was a different case (“__EVENTTARGET” empty at postback) due to the fact that the postback was generated by a simple submit.
Also : “implementing IPostBackDataHandler goes over IPostBackEventhandler when control's implementation is checked (postback data checked and determined what interface implementation to call) so when control implements both interfaces, IPostBackEventHandler implementation must be manually called since framework deals then only with IPostBackDataHandler “ http://www.cetix.de/DotNetNews/Thread8197-About_the_PageRegisterRequiresRaiseEvent_and_PageRequiresPostBa.aspx . This did not sound quite right either but it got me thinking about some possible connections between the two interfaces.
Still i didn't understand the behavior in my case. I found this rather cryptic phrase in a MSDN article:
“How does ASP.NET recognize the control responsible for handling the postback? When no controls referenced in the request body implement the IPostBackEventHandler interface, the page class looks for the __EVENTTARGET hidden field, if any. The contents of the field is assumed to be the ID of the control that caused the postback. If this control implements the IPostBackEventHandler interface, the RaisePostbackEvent method is invoked.“
http://msdn.microsoft.com/msdnmag/issues/06/12/CuttingEdge/
At first i thought it was a mistake because it didn't sound like anything else i read before about the RaisePostbackEvent. So what it actually says as i understand:
-if no controls, that have their UniqueID in the post collection, implement the IPostBackEventHandler interface
- ASP.NET “looks for the __EVENTTARGET hidden field, if any” (it might be empty in the case of a simple sumbit, not through __dopostback), if the control with this UniqueID implements the IPostBackEventHandler interface, the RaisePostbackEvent method is invoked
-if there are controls that have their UniqueID in the post collection and implement the IpostBackEventHandler ???????????? THIS IS NOT ANSWERED BY THE ABOVE PHRASE.
Upon further inspection this seemed to be my case: “there are controls that have their UniqueID in the post collection and implement the IpostBackEventHandler“ (besides the control that i was expecting the RaisePostbackEvent to be called for).
Another important fact is that “the framework will only call RaisePostBackEvent on one control.” as is expected, only one control can be responsible for the postback.
But it seems that, in my case, ASP.NET considered that it was not the control with the UniqueID contained in the “__EVENTTARGET” but it was another control that implemented IpostBackEventHandler and had it's UniqueID in the post collection.
So in my case i had two solutions:
-remove the other controls UniqueID's from the post collection (the controls were rendering hidden fields with the same name as their UniqueID, so i changed the name). The controls were only implementing the IpostBackEventHandler interface.
-for the other controls that had their UniqueID's in the post collection also implement the IPostbackDataHandler interface. This seemed to help the ASP.NET know that the UniqueID's in the post collection were in order to call the methods of the IpostbackDataHandler and it din not register the other controls for a RaisePostBackEvent (if the “__EVENTTARGET” was not = to the UniqueID of the control). So it seemed, after all, to be a subtle connection between the two interfaces. It seemed that the IpostbackDataHandler had priority in some way.
So i have tried to fully understand the mechanism in which ASP.NET decides to call the RaisePostbackEvent for a control:
-if no controls, that have their UniqueID in the post collection, implement the IPostBackEventHandler interface
-ASP.NET “looks for the __EVENTTARGET hidden field, if any” (it might be empty in the case of a simple sumbit, not through __dopostback), if the control with this UniqueID implements the IPostBackEventHandler interface, the RaisePostbackEvent method is invoked for it.
-if there are controls that have their UniqueID in the post collection and implement the IpostBackEventHandler
-if the controls also implement the IpostbackDataHandler (the UniqueID is considered to be in the post collection in order for the IpostbackDataHandler methods to be called)
ASP.NET “looks for the __EVENTTARGET hidden field, if any” (it might be empty in the case of a simple sumbit, not through __dopostback), if the control with this UniqueID implements the IPostBackEventHandler interface, the RaisePostbackEvent method is invoked for it.
-if the controls don't implement the IpostbackDataHandler
ASP.NET considers that the UniqueID's are there in order for the IpostBackEventHandler methods to be called, and it goes on registering the controls for a RaisePostbackEvent, so multiple controls are registered for a RaisePostbackEvent. But because RaisePostbackEvent is called only for a single control per request, the RaisePostbackEvent is called for a control that isn't necessarily the control that has the UniqueID equalt to the value in the “__EVENTTARGET”. ASP.NET seems to call the RaisePostbackEvent for the last registered control.
This mechanism seems to explain the behavior in my case. If some of you could confirm or infirm this scenario i would appreciate it.
|
|
|
|
|
Hi All
Can someone help me with getting a format datetime function which returns like this
1) 2/1/2007 - 2/28/2007 -------- current month range
2) 1 Jan 2007 - 31 Dec 2007 --- current year range
IS there any function available for this or not?
Thanks
|
|
|
|
|
You can use DaysInMonth to get the number of days in a month. The rest, you have to build yourself, there's no function that returns that string.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have the following setting in my web.config file:
<location path ="Secure">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
i want the pages in Secure folder to be accessed as "https" rather than http. However the other pages of the application still use http
can some one help how to do this
yojimbo
|
|
|
|
|
you have to enable the ssl in your web server.
First you have to create SSL server certificate using IIS certificate wizard.
then copy the contents from tht text file.
Go to www.versign.com
register yourself after completing the registeration paste the text file information in the given text area(Certificate Signing Request(CSR) information).
after getting the trial ssl certificate. open the IIS certificate wizard and continue the same process with the new CSR information.
then you can use your web files through the secured protocal.
like https:\\localhost\samplewebsite
see the reference
https://www.microsoftelearning.com/courseAccess/coursePlayer.aspx?courseId=26043&topicId=107335[^]
Sathesh Pandian
|
|
|
|
|
my web application connects to an external databse to effect a particular transaction.
This is activated when the user clicks a button.
Before this transaction is sent to the external database, the status flag is "1".
if the transaction is successful, the external database returns the status flag as "2".
Now, i need to write a code that will display to the user when this process is going on
sth like "Transaction is progress".
I also need a mechanism that will be constantly checking the status flag so that immediately it changes to 2, a message will be displayed to the user that "Transaction successful".
thatz what i want to accomplish.
my databse is SQL Server 2005 express edition.
I will appreciate urgent solution to this challenge plsssss.
Thanks.
Abiodun
Abiodun
|
|
|
|
|
I have GridView template column which gets data from a sql server 2005 database table column which is varchar(1). I need to expand these columns to their full forms as follows:
if it (B) i need to display Both
(P) Appropriations
(L) Allocations
(N) None
thanks again.... code project is the best.
Cheers,
Murthy here
|
|
|
|
|
You can use a CASE statement in your SQL to return the full word instead of the single character.
CASE<br />
WHEN booleanExpression1 THEN result1<br />
WHEN booleanExpression2 THEN result2<br />
...<br />
WHEN booleanExpressionN THEN resultN<br />
<br />
[<br />
ELSE elseResult<br />
]<br />
END
I used this site http://www.4guysfromrolla.com/webtech/102704-1.shtml[^] as a reference.
Hope this helps.
|
|
|
|
|
Hi
I am having a query
When we do any authentication in asp.net then we specify <identity impersonate="true">
then my question is
what will happen when impersonate="true" what if impersonate="False"
Thanks
Karan
|
|
|
|
|
Hello everybody please help me if you can I just need to know how to set some text between ? dinamicly.It is comming from some db!
Best Regards
N.Nikolov
when i want to read something good just seat and type it
|
|
|
|
|
you can use the div tag!! lets say the div tag's id is div1 then div1.innerhtml += "whatever you want to do" + your databse values retrieval like ds.tables.rows[][" ddds"].......
Gautham
|
|
|
|
|
You can give any element an id and set it to runat the server:
<meta id="meta" runat="server" />
Then you can access it in your code behind:
meta.Attributes("NAME") = "description"
meta.Attributes("CONTENT") = "this is my description"
|
|
|
|
|
hi friends i am using asp.net 2.0 with ajax toolkit.
my ajax is working fine but wile working with ajax i don't get alert box .
I get confirmation box but alert box is not working properly so what should i do to give alert messages pls help me
it is urgent
thanks in advance
|
|
|
|
|
Hi
How can i create a multilingual site???
Regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
It's a bit of work but you need to look at using resource files. In ASP.Net you can add a global resource file or each page can have it's own.
|
|
|
|
|
you have to create shared assembly files and create culture information in that file so that multilingual site can gather the information if the user clicks the specified language like en-US ,en-UK etc....
Sathesh Pandian
|
|
|
|
|
Hi,
We are facing one issue in our web application.
Architecture is we have one end user site which fetches data from database and fetches images from share point site.
In end user site in one of our page we show grid which contain information along with the images related to that row. To show images we use one function
which request to share point site for images with Id/pwd for authentication.
This function is working properly.
There are at least 50,000 rows in database and which we are showing in grid. But not all them having images.
In grid we are able to show all images properly. Currently we are showing 10 records per page means grid page size is 10.
Now the issue is :
On the same page there is a link which opens a popup, this popup shows all records in one grid without paging means all records on one page.
In this case we use same function to fetch images from share point and but this we are not able show all images properly some of the image are Red Cross
so we confirmed that whether images are present in share point site but the images are there in share point site.
above case we tested for 350 records also ... still only 190 to 180 images get download and rest of the images are red cross but when we right click on them and select Show Image option then they get appear.
Explanation about function which fetches images from share point site
is as follows
Request to share point site will returns byte array in response for one image at a time means if there are 300 images will call this function 300 times.
When we get this byte array will use Response.WriteBinary to show this image.
I am not able to understand why images are not appearing and why they are appearing after right click and show image option.
Is there any issue related to memory ??
Is there any limit to show no. of images on one aspx page ??
Can any one help me in this issue …
Thanks in advance
|
|
|
|
|
How do you submit to another form using the submit button??
Ty
|
|
|
|