I'm kinda new to web services and want to make sure I am doing things correctly.
I have a custom object which has sub objects as well. (let's say Company object, sub object is collection of Employee objects)
I want the web service to return a collection of Company objects. Do I make the service return a Dataset and custom generate a dataset with datatables representing the different objects?
What is the best way to do this? I tried to just serialize it, but that doesn't seem to work either.
I tried this dll
[URL]
But the output XML doesn't seem to include the sub object.
I created a simple gridview user control with a custom property ProfileType which should load different records depending on the ProfileType value when attaching to a web page.
This is my web page:
[code]....
how I can expose user control custom property at its code-behind file.
""Object reference not set to an instance of an object."" Protected Sub CreateUserWizard1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.Load Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=True") Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT TOP 1 EmployeeId FROM a1_admins Order by Id DESC", SQLData) Dim label11 As Label = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Label11") SQLData.Open() Dim dtrReader As System.Data.SqlClient.SqlDataReader = cmdSelect.ExecuteReader() If dtrReader.HasRows Then While dtrReader.Read() label11.Text = dtrReader("EmployeeId") End While End If dtrReader.Close() SQLData.Close() End Sub End Class
I'm getting the object refernce not set to an instance of an object error in the code below.I couldnt figure it out, where I'm going wrong.VB.NET Syntax (Toggle Plain Text)
We've got some WCF services we're hosting via IIS. The application in general uses Forms Authentication, and we'd like to continue making that available for web service clients. We just have a <authorization><deny users="?"> in our web.config and some authentication/redirection goodness that gets everything done.
The problem is we'd like for users to be able to access the metadata for the services without authentication. Can they visit /services/v1/ArtifactService.svc?wsdl anonymously and yet still require authentication for /services/v1/ArtifactService.svc/rest/GetArtifacts?studyId=123? If so, I can't figure out the right incantation in the configuration.
The best I can think of is to set an absolute URL in the metadata service behavior, but then I have to doctor the path on install anywhere we deploy. (<serviceMetadata httpGetEnabled="true" httpGetUrl=[URL]
I keep getting this error Object reference not set to an instance of an object. What i want to do is when the button is clicked my panel is visible with a textbox of the id number, of the row that they clicked. by id number i mean the column id, and the number given to it by the database.
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Dim button As Button = CType(e.Row.FindControl("button1"), Button) Dim id As Label = CType(e.Row.FindControl("id"), Label) button.OnClientClick = _ Panel1.Visible = True Label2.Visible = True Label2.Text = id.Text UpdatePanel1.Update() End Sub
I have a detailsview that contains a radio button list, and a couple of check boxes. I want to run some code when the radiobuttonlist selection is changed, or when the checkboxes are checked or unchecked. how I can do that even though the controls are nested inside another control?
how can I expose the properties of a hyperlink column in a gridview so I can program then in vb code? For example I want to change the property of the DataNavigateUrlFormatString programatically using vb code? How can I do this?
Everything works fine on my dev machine which is running Windows 7. However, when I deploy my app to my production server at MaximumASP running 64 bit Windows 2008 R2 Standard, I just can't access those pages that are handled by my URL Routing logic. I'm getting the infamous "Object reference not set to an instance of an object." error.
The code below is my URL handler for Mailbox module in my application. I've defined mail folders in my database. All this does is if user is looking for /mailbox/Inbox, it looks up the folderID and sends the user the mailbox.aspx page which is expecting a folderID
I've got a vs08 web site project that was recently added to tfs2010. now when i look at the code behind on a user control, a form object is not found in the code behind.
[code]....
Error:
The name 'txtbxSearchWorkOrder' does not exist in the current context
why this is not working on this page? I've got other pages with textboxes and no issues.
I'm having trouble accessing custom profile properties that I've declared in my web.config using the TableProfileProvider available at [URL] I set everything up according to the instructions but keep receiving an error stating "The type or namespace name 'Profile' could not be found" whenever I refer to the Profile object in my codebehind. My web.config is:
I am creating a web application that allows a user to download a csv file of a gridview. However, after looking at tutorials online such as http://www.aspsnippets.com/Articles/Export-GridView-To-Word-Excel-PDF-CSV-Formats-in-ASP.Net.aspxand such, I successfully got the table I wanted but there are HTML content appended to the table as well.There was also a similar problem being brought up on the forum,http://forums.asp.net/p/1528174/3692826.aspx. The solutions didn't help me much though. However, I am not really sure how Handlers can benefit this. Furthermore, I don't want the user to be navigated to a blank page just to download the csv file. I tried to debug and insert removal code to remove the html code before the response object is being wrote out but seems even at the end of the writing method, the response object seems to be holding just the table content only.
I have a base class with several derived classes. I want all of my derived classes to have the same Public Shared (static) method with their own implementation. How do I do this?
I am using a custom membership provider. I want to expose additional properties under User class.
So in my custom membership provider class I added few Properties (FirstName, LastName, Address, etc) and set their value in ValidateUser(). However back in aspx.cs if I type User. I do not see FirstName, LastName and Address in intellisense.
Is what I'm attempting to do even possible? Or do I need to resort to using my own custom user class? In which case I wouldn't need to use custom membership provider because I can program my custom user class to do everything that custom membership provider can do. Only thing is I would need to pass this user object in session object.
CustomControl.ascx <%@ Control Language="vb" CodeBehind="CustomControl.ascx.vb" %> <asp:Panel ID="myPanel" runat="server"></asp:Panel>
I'd lke to expose that panel as a property that I can use at design time.
CustomControl.ascx.vb <ParseChildren(True), PersistChildren(False)> _ Partial Public Class CustomControl Inherits System.Web.UI.UserControl #Region "Members and Properties" <PersistenceMode(PersistenceMode.InnerProperty)> _ Public Property SomePanel() As Panel Get Return myPanel End Get Set(ByVal value As Panel) myPanel= value End Set End Property #End Region Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.Write(myPanel.HasControls.ToString()) End Sub End Class
Pretend i have an existing web-site, e.g.:[URL]i now want to expose a mobile version of this web-site:
m.stackoverflow.com IIS, with its host-header name resolution, would normally require two web-sites to be created: www.stackoverflow.com m.stackoverflow.com
Except now i have two web-sites in IIS. This means i have to duplicate code/files between them. i don't need to (nor do i want to) duplicate all the "model" and "controller" code between two web-sites. i would much rather have one web-site that exposes a mobile version.
i could have the default page in m.stackoverflow.com simply perform a redirect to a mobile landing page on the "real" web-site:
I'm having trouble exposing a method to a silverlight client from a WCF service although I can expose properties.
My WCF service has a LoadDeal method which returns a Deal object
public Deal LoadDeal(int dealerId) { Deal d = new Deal(); d.LoadDeal(dealerId); return d;
[Code]....
This works fine and the Refernce property can be accessed from the silverlight client.
But when I try to expose a method such as the CancelEdit method below, I can't find a way to expose this method to the silverlight client:
public void CancelEdit() { //Add logic to cancel changes here. }
I've tried adding the DataMember annotation but the compiler complains. I've re-compiled without an annotation and then updated the service reference but nothing seems to be working.
Is there a way to put a button on a specific date in a calendar object? Specific dates in my website might have a lot of data that needs to be shown and I want to place a button on that date to open up a new webpage or make a panel visible with the information. Below is the calendar object and the dayrendering routine to place the current information in the calendar object.
[Code]....
Dim linkStr As String e.Cell.BackColor = Drawing.Color.Red linkStr = "<span style=""font-size:11pt; font-Weight:bold; color:white""><br />Error Loading Date: " & e.Day.Date & _ "<br /><br />Check Date and Re-Submit!" e.Cell.Controls.Add(New LiteralControl(linkStr)) end sub
l Im downloading Pdfs using WebClient I used below code
try { WebClient wc = new WebClient(); Uri uriadd = new Uri(@"ftp://xxx.yyy..../httpdocs/FH/Foldername/" + clientorder1[i].Cloi_id + ".pdf"); wc.Credentials = new NetworkCredential("xxxx", "zzzz"); }
Its working fineĀ but some times Gives Error like Object synchronization method was called from an unsynchronized block of code.. Why this Error coming ....