|
That error occurs when you are trying to access a method or property that does not exist on the type you are using but might exist on a type that inherits from the type you are using.
Since no one else will answer the question, here's my analysis:
The ConfigurationSettings.GetConfig("IntranetSettings") will return a System.Object. You then try to access an array element ("ConnectionAsset") from it, and System.Objects aren't necessarily arrays. This is a likely cause of the error.
You should probably resort to explicitly casting the results of the GetConfig() method to whatever type it ends up being. After that, make sure that the SqlConnection() method is taking in a string rather than an object.
|
|
|
|
|
This is your error
ConfigurationSettings.GetConfig("IntranetSettings")("ConnectionAsset")
It's trying to grab a string value from the configuration setting called "IntranetSettings"
Normally it's just a string ...
"Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"
But yours is stored in the project somewhere. Your need to repair the projects resource table.
|
|
|
|
|
&<>Hi All,
I have added ajax modal popup extender and on button click i am opening Modal Pop up , it is opening popup in dev server ,but it is not opening popup in UAT serever.
And i have added below tags in web.config file.Please suggest me to do better way.
-------------------------------------
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
------------------------------
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
------------------------------------
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
|
|
|
|
|
hi,
I'm assuming that the button click will trigger the modal popup through the client side script. If that the case, try include this line into the script.
<script type="text/javascript">
if (typeof (Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
function showModalPopupViaClient() { ... }
function hideModalPopupViaClient() { ... }
....
....
<script>
Thanks,
Bryian Tan
|
|
|
|
|
I think you have to load the AjaxControlToolkit client extensions on the production web server, there is a small download from Microsoft that you run on the server. I'm not sure about Server 2008, but I do remember having to load several programs to stuff like the chart controls to work.
ASPAJAXExtSetup [Microsoft AJAX Script Library^]
ASP.NET AJAX integrates client script libraries with the ASP.NET 2.0 server-based development framework. This new Web development technology extends ASP.NET, offering the interactive user interface benefits of AJAX with a programming model that is more familiar to ASP.NET developers, making it very easy to add AJAX to your applications quickly and with minimal effort. However, ASP.NET AJAX isn’t just for ASP.NET development. You can take advantage of the rich client framework to easily build client-centric Web applications that integrate with any backend data provider.
|
|
|
|
|
I am having an issue with canceling an event I added to the window's onBeforeUnload event, when the browser is IE (7,8, &9). In FireFox my RegisterOnSubmitStatement is sufficient to set a flag to skip the warning, but in IE that code gets called after the onBeforeUnload.
Here is the code in question:
ScriptManager.RegisterStartupScript(page, typeof(Functions), "NavigateAway", @"
window.SuppressExitWarning = false;
window.onbeforeunload = confirmExit;
function confirmExit(evt) {
var message = '" + JsEscape(message) + @"';
if (window.SuppressExitWarning == true) return;
if (typeof evt == 'undefined') evt = window.event;
if (evt) evt.returnValue = message;
return message;
};", true);
ScriptManager.RegisterOnSubmitStatement(page, typeof(Functions), "AllowNavigateAway", @"
window.SuppressExitWarning = true;
");
If you add an alert to the "AllowNavigateAway" script, you can see the behaviour in IE -> The onBeforeUnload message pops up, then the alert.
I have tried several ways to solve it, but they all have a flaw of some sort.
A) Adding a setting of the global variable on the OnClientClick event to all possible form submitters will invariably miss something. That is to say, I do not have any idea of what controls will be on the page and even if I iterate through the control tree, I am likely to miss something that it not usually a control that submits but has it's AutoPostBack set to true. (e.g. DropDownList)
B) Using jQuery to attach a method to the submit of the form is not an option because CKEditor has locked it up.
C) Tracking the postback through a hidden input fails because it is not updated until after the onBeforeUnload.
Any thoughts or ideas would be greatly appreciated.
|
|
|
|
|
Hello,
We have a web page which requires user to answer questions in form of dropdown list. these answers are written to database. ASP.NEt with SQL server. There is some javascript validation to make sure the user selects a value from the dropdown list.
When it is the above browser, the answers are not being captured. I have added some logging to this web page. since this is working in case of IE browsers. Listed below is the debugging statement.
Browser Type : Desktop
Browser Name : AppleMAC-Safari
Browser Version : 5.0
Browser Major Version = 5
Browser Minor Version = 0
Browser Platform = WinNT
Browser Supports Frames : True
Browser Supports Javascript : 1.4
Any thoughs/ ideas is much appreciated.
|
|
|
|
|
You may have a javascript error when posting back the form to the web server, that is interfering with the set value of the listbox.
You have to remark out the Javascript file, and test the form postback to the server to make sure it works, and then add the Javascript back in 1 object at a time until the whole form works.
If your using the Validator, which is javascript, then that may be returning a "return false", which cancels the form postback to the server.
At the end of validation, you need to return true, to post the form for a round trip to the server.
|
|
|
|
|
I'm using VB.NET and ASP.NET in VS2005 to create a web application that has some very similar code in five different webpages. This code enables/disables various controls depending on the actions allowed in the current page. I would like to consolidate this code into a subroutine in a class.vb file and call it from the aspx.vb files.
I’m using a Master Page with four contentpageholders. Only one has the controls in question, but herein lies my problem. I can access the controls on webpages not using the Master Page, but can’t make the code work with the contentpageholder.
Here is the code in the class file:
Public Sub SetControls(ByVal Controltype As String, ByVal StartCtrl As Integer, ByVal StopCtrl As Integer, ByVal SetValue As Boolean)
Dim myPage As Page
Dim intIndex As Integer
Dim objPlaceHolder As ContentPlaceHolder
myPage = TryCast(HttpContext.Current.Handler, Page)
objPlaceHolder = TryCast(myPage.FindControl ("rightcolumn"), ContentPlaceHolder)
**** If Not objPlaceHolder Is Nothing Then **** “Nothing”
Select Case Controltype
Case "TextBox"
Dim txtTextBox As TextBox
For intIndex = StartCtrl To StopCtrl
txtTextBox = TryCast (myPage.FindControl("TextBox" & intIndex), TextBox)
If Not txtTextBox Is Nothing Then
txtTextBox.ReadOnly = SetValue
Else
Exit For
End If
Next
End Select
End If
End Sub
End Class
And I call the procedure like this:
Sub LockControls()
Dim objMiscUtilities As New MiscUtilities
objMiscUtilities.SetControls("TextBox", 2, 20, False)
End Sub
Whenever I test the program the “objPlaceHolder” is always nothing, so the rest of the code is bypassed.
Any help will be greatly appreciated.
Ron Brewer
|
|
|
|
|
Hi,
I have a question here,
TryCast(myPage.FindControl ("rightcolumn"), ContentPlaceHolder)
In this sentence is 'rightcolumn' your contentplaceholder id in your page?
To access any control in your content form,use the below way.
Dim MyTxt As TextBox
MyTxt =CType(YOURContentPlaceHolderID.FindControl("YOURTextBoxID"), TextBox)
Hope this helps.
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
I tried your example and got a "rightcolumn not declared" error. If this is not what you meant tell me what I should use instead of the id of the contentplace holder and I will try that.
I've seen some posts on the web indicating that I should be using "Master.FindControl" to get to the contentplaceholder where the controls are, but then I get a "Master not declared" error. That code works in the aspx.vb page, but not in the class.vb.
I'm sure this has been attempted before, but so far my web surfing hasn't turned up any examples. It seems using a master page with contentplaceholders severely limits what you can do in a class file.
Anyway, thank you for your interest and input.
Ron Brewer
|
|
|
|
|
|
This problem has been resolved (with a lot of help from my friends) and I thought it would be worth while to post the solution to help any others who might be interested. It only took two relatively minor changes to make the code work. Here they are:
Original Procedure declaration
Public Sub SetControls(ByVal Controltype As String, ByVal StartCtrl As Integer, ByVal StopCtrl As Integer, ByVal SetValue As Boolean)
Original call to procedure
objMiscUtilities.SetControls("TextBox", 2, 20, False)
Corrected Procedure declaration
Public Sub SetControls(ByVal Controltype As String, ByVal StartCtrl As Integer, ByVal StopCtrl As Integer, ByVal SetValue As Boolean, ByVal objPlaceHolder As ContentPlaceHolder)
Corrected call to procedure
objMiscUtilities.SetControls("TextBox", 2, 20, False, Master.FindControl("rightcolumn"))
Ron Brewer
|
|
|
|
|
Great job!!
-Manognya
__________________________________________________
$ God gives what is best.Not what all you wish
|
|
|
|
|
Hi,
I'll make it short and clear (I hope).
We have two teams developping our product, the R&D and the 'Integrators'.
I'm not sure how the Integrators are called in english, maybe TPAM (Third Party Application Maintenance), anyway, let's say that Integrators = People working on the base product, adding or changing functionalities for a specific customer. And the R&D team beeing in charge of doing what's common to all of them (the customers).
The R&D team is in charge of developping functionalities available to all our customers, and the other team only does specific developments for specific customers.
The problem we're dealing with is that both teams may develop on the same web pages, controls, business logic etc. What happens is that our Release Manager deploys what the R&D team has been doing in some sort of common workspace, and he can't be aware of what's from one team or another, so a lot of times, the Integrators work is lost and our release manager spends hours finding the 'lost changesets' and re applying those modifications.
We're need to solve this problem and what we came with far now is to develop some sort of API exposing all the common asp.net events (page_init, load, render, etc.), we also should fire events when entering/exiting BL and DAL functions allowing the Integrators to develop 'manually', maybe injecting some asp.net code into the existing pages, also some code behind, javascript, etc. I'm not really sure if this is a reasonable idea or not, we've just been thinking for like 10 minutes and I wondered what did you recon in this kind of situations.
This is just an idea, because they may develop everywhere... Web, BL, DAL and Database (we have a project for that).
Just to be clear, we're developing a product, I'm not sure how it's technically called in English but our application will keep growing over time so we really need to do this right otherwise it will cost us a lot of time and money to correct that later when we'll have people using our 'API' (I'm calling this an API but I may be wrong about that)
Anyway, we're stuck here, I hope I was clear enough, if not tell me and I'll try again!
Thanks in advance
PD: I posted this in the ASP.NET and Design and Architecture forums, I apologize if this is not ok and you're free to delete one of them.
|
|
|
|
|
Hello,
I am new to implementing HTTPS. My site has all capabilities for https and the server is ready with the certificate. Now, i want to implement a functionality like we see in normal websites with https.
Like in gmail, if we try to change https in the addressbar tp http it will come back to https. The user cannot change it to http.
Any suggestion how to do it.
Please note that I have only one page to be in https and rest all are in http. I am doing in MVC 3.
Thanks,
modified 23-Jan-12 10:28am.
|
|
|
|
|
Something like below
Context.Response.Redirect(Context.Request.Url.ToString().Replace("http://", "https://"))
and vice versus in the Page.OnPreRender Page Cycle
|
|
|
|
|
Getting 404 file not found error while viewing the report after uploading project to the server using asp.net and ajax.
|
|
|
|
|
|
I've already read some articles about this matter, but I'm not sure how to solve my problem.
I work on project in which we use MVC3. The project should manage school system (schools, pupils, teachers, parents, users, roles and so on. In the center of such a school management system is - schedule of subjects.
We get data from MS SQL Server through EF4 (database first approach), which means all entity classes are created automatically. Therefore, I have such a classes that represent database tables such as School, Pupil, Teacher, Role and so on. And I have DbContext derived class.
We primarily know how our presentation (UI) layer should look like.
The problem is in layer between UI and classes we got automatically by using EF4 that I've already mentioned. I've read about repository and unit of work patterns and understood how they work. I've thought we could apply those patterns, but our project architect wants to use something else. He wants to have clear separation of layers. He wants to call simple methods from controllers that are placed in business layer, which means almost whole logic should not be in controllers, but in that business layer.
I'm not sure now what I should start with. I have all those entity classes School, Pupil, Teacher, Role and so on. And I have DbContext derived class. That means those classes are input for business layer. What should be output of business layer? How could I design business layer?
Thank you in advance.
Goran
|
|
|
|
|
I would suggest to keep your entity classes (generated from EF4) into database layer (separate C# class library). Don't keep them in models folder.
Your business layer methods should call them.
Your controller can call these business layer methods.
To use Entity class in your web project, add reference of your database layer.
This kind of architecture will give you a lot of flexibility in future.
|
|
|
|
|
Hello,
I am able to install multiple sites in http on the same server (using the http header).
unfortunatly i can't install it in https, I installed the certificate on port 443 for the first site then what must be done to the second site? Port 443 is used by the first site, Thanks for your help.
NB: I use IIS v6.0
|
|
|
|
|
guys, i have a problem that doesn't seem logical.
i have added this code to the Render() method of my new web control:
System.Web.UI.HtmlControls.HtmlGenericControl PreviewFrame = null;
if (!string.IsNullOrEmpty(this.PreviewFrameID))
{
PreviewFrame =(System.Web.UI.HtmlControls.HtmlGenericControl) this.NamingContainer.FindControl(this.PreviewFrameID);
if (btnSubmit == null) throw new HttpException("PreviewFrameID must point to an existing control on the page.");
PreviewFrame.Attributes.Add("name", PreviewFrame.UniqueID);
}
this code should add a name attribute to the Preview Frame to which i can target a response with type "image/jpeg".
<iframe id="PreviewFrame" runat="server"></iframe>
but amazingly, this doesn't work!!
Help people,so poeple can help you.
|
|
|
|
|
Ali Al Omairi(Abu AlHassan) wrote: target a response with type "image/jpeg".
What do you mean by this? You don't need a name attribute to identify an element, use the id. Most browsers will render the name attribute from the id attribute.
No comment
|
|
|
|
|
Sir;
I don't need to identify the element, actually I am trying to assign its name as a target of a form which I can respond its submission with an image/jpeg response. look the code below:
first i do the submission:
var iframe = setting.previewFrame;
var form = document.createElement('form');
form.method = 'post';
form.action = settings.action;
form.target = iframe.name;
then I build the response:
Response.ContentType = "image/jpeg";
Response.BinaryWrite(GetFileBytes());
Response.End();
using the iframe id wont work on FF or IE which are most used.
Help people,so poeple can help you.
modified 22-Jan-12 10:58am.
|
|
|
|
|