how 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.
I'm looking to add controls dynamically to a table across multiple functions. I'm trying to convert this from a C# app to a web app using asp.net, though this is my first time using asp.net with no web development background. I read the creating tables dynamically in the FAQ but I'm still not sure how to do this.
When pressing the submit button on my form, it will create a table in a place holder. Eventually I would like it to generate urls based on the users input and do this in a function other then the one I created my table in.
In my C# app I was able to add text to a listbox using: lstOutput.Items.Add("Text"); across multiple functions but I'm having trouble doing this with a table.
I understand that my table is a local variable in the submitButton_Click function, but how do I make it global to add rows, cells and controls to it in other functions?
I am using silverlight, vs 2010, and need to write some basic functions.
Some of the functions are getting a string and find if it's odd or even, and some of them getting status from database.What is the best way doing so : Javascript, ASP.NET, AJAX?
Need an example of code, that also include some dlls/assemblies,
When I create a form, I try to make accessibility a top priority, but the output from asp .NET negates some of this. For example, when I set a label tag for an input tag, I create it a such:
I have a requirement to automate the testing of .net application that generates some output files in pdf or html based on account number. How can I automate it to compare the results from DEV environment and the production environment? What is the best way to do so?
I have a Web Deployment Project in my solution. The solution consists of the MVC2 App and another Class Library.
In the Web Deployment Project properties I have the Merge all outputs to a single assembly option ticked and I have given it a name.
When I look in the bin folder I have all my reference DLL's from my MVC app, a DLL with the name of my MVC project and then a DLL by then name I gave it when choosing the Merge all outputs to a single assembly option.
I imagined this option would create 1 DLL not all DLL's plus another one.
I have a custom control which is rendered as a hyperlink:
Public Class TestControl Inherits System.Web.UI.WebControls.WebControl Implements IPostBackEventHandler Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent Trace.WriteLine("Hyperlink 1 clicked") End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter) writer.WriteLine("<a href=""{0}"" id=""{1}"">Hyperlink 1</a>", _ Page.ClientScript.GetPostBackClientHyperlink(Me, "Hyperlink 1"), _ Me.ClientID) End Sub End Class
This works fine. It also works nicely when put inside an UpdatePanel: Only the UpdatePanel is refreshed, no full postback is performed.
Now I would like to output a second hyperlink in the Render method. If I use the same id (Me.ClientID), everything works nicely, but this obviously results in broken HTML (no two controls are allows to have the same id attribute). If I use different client IDs (like Me.ClientID & "_1" and Me.ClientID & "_2"), a full postback is performed when the hyperlinks are clicked.
Is there some way to tell ASP.NET AJAX: "All postbacks of the following client IDs should be done asynchronously: ..."?
I've been watching a video on Scott Hanselmnn teaching MVC 2 tricks/tips. He mentions how MVC 2 by default uses ASP.NET Web Forms view engine to render the output of the views; he mentions that the web forms view engine is a little slower than it could be for MVC 2 since it generates a control tree and then outputs the HTML to the page (I hope I said that right).
I was wondering what he meant by web forms generating a code tree before outputting the HTML to the page. Does anyone have insight on the view engine of Web forms and the steps of the rendering process works for ASP.NET and MVC2?
I am developing a software that uses number precision, but I have this problem, it happens that when I take a string to convert to double it outputs me with a different culture.
For example I use
Convert.ToDouble("4089.90"); // it outputs 40.899,00
Is strange cause in my computer it works OK but on the client's PC (with the same culture in regional settings) shows me the latter output. I know I can fix it using
But there is a lot of code in the program using "Convert.ToDouble" and I wouldn't like to change all of it, on the other hand I want to understand why this happens.
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.
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?
I 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.
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.
For 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 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?
I have a base class called BasePage, and a master page called SiteMaster. All my content pages inherit BasePage using BasePage instead of System.Web.UI.Page. Now, I need to access some functions in BasePage from my master page SiteMaster, let's say, the function is called "DisplayClientName()". How can I do it? Searched the Web, have found tons of similar questions but not solid solutions.
I have a page that contains a few user controls which all use an id in a querystring. I want to change this so that the page can send the id to the user control and can call a function on the user control.
Also is it possible for the user control to get the id from the page or a control on the page as its parent?