Web Forms :: Looking For Common Functions?
Dec 20, 2010is there any websites that holds common functions such as Check the input is string or not, convert date in different format etc.,?
View 4 Repliesis there any websites that holds common functions such as Check the input is string or not, convert date in different format etc.,?
View 4 Replieswhere should commonly used utility functions (to be used in multiple .aspx files) be coded? I currently have these common funcs in an .ascx user control that's referenced in each .aspx file.
View 2 RepliesI want to create a common unit test function to check all functions based on parameter
for e.g
[code]....
what logic should i write inside this method so that by passing a actual function in parameter methodname and then the common method should execute that function and should return the output.
i am using entity framework for all functions which has been created in my project and now i dont want to create a separate unit test function for each function.just one function should do the job based on different parameters...
is that possible.. ?
I have a solution I'm working on in VS2010 Professional, using ASP.NET 4.0 with the AJAX Toolkit.This has been working fine, but when I started it up today, I got the runtime exception shown above. This exception occurs on any page with a control from the toolkit.Sometimes when I load a page, I get an exception "Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, ublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified." If I then reload the page (without making any changes), I then get the exception shown in the subject line.I tried dragging an AJAX Toolkit control from the toolbox onto a page, and then deleting it, and that worked - once. The next time I tried the page (or any other), I got the exception again. Dragging a control out didn't help this time.
View 5 RepliesMany of the pages of my website have identical code behind files (using VB).How do I set up one code behind file that can be used by all these pages?
View 3 RepliesHow to call Sci lab functions in Asp.Net. How to downlaod its API
View 1 Repliesi want to add this functionality in all asp.net pages
1.if xyz cookie missing , return empty html (<html></html>)
2.if abc query string parameter missing ,return empty html.
similary .....
where should i put this conditional logic and where should i define to return empty html and not the page content .
I wanted to use some javascript functions in a ASP.net 3.5 web site. I have added a javascript1.js page in the Sites Folder with a Javascript Test function.
<script
src="~/Scripts/Javascript1.js"
type="text/javascript"></script>
I have made 3 web controls which need to be accessible between eachother. First control is main control (controlA). Other 2 controls (controlB and controlC) are referenced in controlA. Now i need to access function from controlC and call it in controlB. I tried adding new reference, but it doesnt work the way I want it.
ControlA is main control and it is merely a table to hold other 2 controls in place. I can access both controls from controlA, but since I need to modify controlC due to drop down menu in controlB i can't force controlA to respond to event in controlB every time it occurs and affect controlC. Or can i? :)
So whenever the event (SelectedIndexChanged) of drop down menu occurs in controlB, I need to set up/change controlC. Problem is, I don't know how to call function from controlC. It may sound very simple to solve and i tried to make a new instance of controlC class in controlB my webpage just wouldn't load.
I have been reading that a value needs to be returned by a function, otherwise the following error will occur:
"Function <function name> doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used."
The cure, I have found, is to return something (i.e. "Return 0") before exiting the function. Can I pass this return value back to the routine that called the function? If so, how do I code this?
Most of the time, however, I find I'm not needing to return a value anyway, and just end up adding "0" to the ends of all my Return statements. Does anyone have any comments on this?
Links referred to:
[URL]
create function StyleGen(@ID int)
View 4 Replieshow I can add outputs to my vb.net functions? The reason for this is that I have functions which return data tables for grid views. But I also want to pass a return value back to the calling routine, so that it knows whether the function succeeded or failed. It would also be good to pass strings back too, in addition to the returned data table.
View 7 RepliesI'm Adding Some Linkbutton At Runtime In InnerHtml Of Div. And I Want To Call a Single Method For All The LinkButton With An Argument. My Code Is Below:
protected void Page_Load(object sender, EventArgs e)
{
DivBookList.InnerHtml = "<ul>";
i = 0;
foreach (IFolder f in Client.MailboxManager.Folders)
I have a function that sends out emails when certain processes are complete. The function works great; however, in our testing lab, I want to be able to see the message that are going out and not have it actually send the messages. Since MsgBox does not work in the web environment, is there a way to open a new page/window from the common code? The page will have the message passed to it for display and I do not want to do a redirect as there are times when more than one email is going out.
View 2 Repliesi want to store master pages in a common library. if i make such a library how can i reference masterpagein Page directive in content page
i read following document for creating sub projects but it did not fullfill my requirement
http://weblogs.asp.net/scottgu/archive/2006/08/16/Tip_2F00_Trick_3A00_-Creating-Sub_2D00_Web-Projects-using-the-VS-2005-Web-Application-Project-Option.aspx
http://dotnetkeeda.blogspot.com/2009/04/sharing-master-pages-across-web.html
I'd like to add a typical 'Signed in as' bar, cf this site.Since it's 'common', first thought is: master page.However any controls designed on a master page are only rendered 'in' the final page...... so you need the 'this' (Page reference) to access the control... so you can't write code 'on' a master page, whose 'this' is not a Page.HttpContext has Session, Request, etc - all useful but none with a 'Page' reference that I've noticedUpdatePanel looks neat, but I'd prefer a non-Ajax solution to learn the 'basic' way before perhaps later making it 'smarter' with Ajax.Question therefore is: how to write a script that is site-wide, for a master page, that references controls on the (rendered) master page, with or without a 'Page' reference.
View 1 RepliesI have some code in my new asp.net app that I need to share. So i created a shared class called
"utilities.vb" and put it in the APP_CODE folder. There is a function I have in there that pulls a person's image based off of their MemberId.
[Code]....
And I can call this function from my page using utilities.FcnGetMemberImage(). Ok, so all good so far until it complains about...
"Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class"
when referring to the Server.MapPath()
But the problem is that if I don't make it a Shared Function, I can't access it from my other pages. But if I do make it a Shared Function, it throws this error. The fix is supposed to be that I either don't share the function, or
"add the shared keyword to the member declaration", according to Microsoft at
http://msdn.microsoft.com/en-us/library/xfsswe45.aspx
But I'm not exactly sure how to "add the shared keyword to the member declaration" or what this means exactly and how this might affect other parts of my code?
Or is there a better way to work around this dilemma?
I've created a function to generate a sitemap of all of my content, and what I'd like to do is update the sitemap every day at midnight, or once a week for example.
How should I go about getting this done?
My website will be hosted in a shared environment if that's significant.
As I am using textbox in html table.How to write common for alll textbox in html table. As we use selected index change inasp.net. Here how to code ?
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
[Code].....
If I have 10 radio button and the value of ten is same 1,0, 2
<asp:RadioButtonList ID="rd_12_a" runat="server" onclick="" RepeatDirection="Horizontal">
<asp:ListItem Value="1">Yes/asp:ListItem>
<asp:ListItem Value="0">no</asp:ListItem>
<asp:ListItem Value="2">other</asp:ListItem>
</asp:RadioButtonList>
So instead of writing if condition for all can i write like this
radiobuttonlist rbl =(radiobuttonlist)sender;
if (rbl.selectedvalue="1" || rbl.selectedvalue="2")
then the javascript modal pop-up will display a message...
All of my scripts run fine in my Master page, and all of the functions run when called in the content pages, but for some reason, all of the sudden contentPageLoad() doesn't run anymore in any of them. I am sure that I have changed something somewhere, but I can't figure out what it is.
View 1 RepliesFor protect against XSS we should make all input from textboxes thoht Server.Htmlencode function.
1) If i let a input go thorgh Server.Htmlencode and save it in database. But what happen if i letter show this input data from database on browerser ...if database input data have <script> it will then make Xss!!!!.
2) I use Server.Htmlencode.. and the user write <b>ss<b>... (label.text = userinput.text;) and i WANT to show ss in browser. What shuld i do for make this happen ??
I knew how to apply Javascript function in html file. How to use javascript(including functions) in code behind file?
View 2 RepliesIs there a way to run server side functions by javascript? There are two things I need to do:
1. Either emulate clicking a link/button, or calling the OnClick function directly (not OnClientClick)
2. Control the back and forward control of the wizard control by using the keyboard
i think The javascript function called by using RegisterStartupScript or RegisterClientScriptBlock executed after the code in the method is executed.I want to execute the javascript function called by RegisterStartupScript or RegisterClientScriptBlock to be executed before the code in buton click method is executed. For that what should i do?
View 5 Replies