Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Wednesday, March 28, 2012

Very Basic Static Method Question - SlideShowExtender

I'm working with the SlideShowExtender to show slides from a database. I have everything working as planned, except for a major oversight which I can't figure out how to get around properly. Internally I am housing a static SlideList object which contains all the slides returned from my DAL. Inside my

static AjaxControlTookit.Slide[] GetSlides() method I am copying the SlideList interal objects into the Slide[] object and then returning it. Now for my problem, naturally because my SlideList is static, there is only one copy across each page. When more than one user is on the website at the same time, obviously they are touching the same slideshow data which is causing a lot of problems. What is the correct way to handle this solution? Was I supposed to place the GetSlides() method in a WebService.asmx webservice, or is it ok to keep them as PageMethods and then correctly keep track of the Slides on a per page basis?

I would rather keep the GetSlides() method as a static PageMethod so I don't have to completely refactor the entire project, however I am not sure how I would correctly go about having Slides and then accessing them within my static methods. I realize this is a very elementary problem, and I feel awfully silly for not knowing the answer!

THanks!

Hi,

Your question is how to return different slides upon different requests, isn't it?

Well, you may pass a parameter (contextKey) into the GetSlides method, and use it to filter some slides.

For example, let's say you plan to filter the slides according to the userName of the one is browsing the page, you assign current user name in Page_Load.

protected void Page_Load(object sender, EventArgs e)
{
this.slideshowextend1.ContextKey = currentUserName;
}

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides(string contextKey)
{ // return a slide array according to contextKey
}

Hope this helps.

Very new to AJAX. Want to insert a record into a database...

Hello everyone,

I am very new to ASP.NET AJAX. I just simply want to insert a new record into a database...

I have a calender, which is using DayRender to highlight days that have meetings on them (pulled from "Meeting" table in database).

When a user selects a date that DOESN'T have a meeting, i want an "Add" button to show that will simply add the calendar's selected date to the Meeting table (the table only has two fields, ID and Date)

I'd like for this to all be AJAXified, so when a user selects a date...it does a partial page render to show the add button (or delete button if there IS a meeting for the selected date already), then when they click the "add" button, it inserts the selected date with a partial page render (or however it works).

Can anyone point me in the right direction? Do I have to create a web service? can i do this just using UpdatePanels? Can someone possibly provide some starter code?

Thanks in advance!

hello.

well, since you're starting, i'd say that this can be done by rather easily with UpdatePanels. Even though i still think they shouldn't be used in most scenarios, the truth is that ~using them makes building ASP.NET AJAX pages easy since you can do most of things on the server side...

Wednesday, March 21, 2012

web method error in cascadingDropdown

i am trying to use the cascading dropdownlist control, using a web service to get items from a database. the web method works fine, but i get a web method error 404 or 500. any help in solving this would be greatly appreciated.

Hi, mnyats.

I solved right now (telling the true, in this exact minute) a problem I was facing that was generating this same error message. In my case the problem was:

1 - I was trying to make cascadingDropDown to work with no service; (I guess it's possible but all the samples I got on the web says no)

2 - On the call of my service, inside my aspx page, I forgot to include the full namespace of the service;

3 - The service was with the attribute: <System.Web.Script.Services.ScriptService()> commented.

I don't know which problem are you having now, but I hope this can help...

See you!@.!

<mnyats> escreveu na mensagemnews:1966118@.forums.asp.net...

i am trying to use the cascading dropdownlist control, using a web service to get items from a database. the web method works fine, but i get a web method error 404 or 500. any help in solving this would be greatly appreciated.

http://forums.asp.net/p/1172554/1966118.aspx#1966118


Hi,

I think Fiddler is a good choice for you to trouble shooting. Please refer to this thread: http://forums.asp.net/t/1172379.aspx

Web service call from javascript and SQL Server 2005 Express

Hi,

I'm developing a web application that uses Ajax to call web services using javascript.

The web service must connect to a SQL Server 2005 Database (express edition) and uses a dynamically created connection. The connection string used to create the connection is right because it works for web page data loading and it uses SQL server authentication mode.

In the development environment the application works correctly, but when deployed on a different machine with a different SQL Server installation, the sql connection in the web service fails returning the following error:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

I've tried all suggested changes in SQL Server Configuration Manager andSQL Server Surface Area Configuration, enabling both tcp/ip and named pipes for remote connection, but the connection is still not working.

The server has a windows XP professional SP2 operating system and windows firewall is active, but i have enabled http from lan and sql server access.

Can you suggest me something?

I must add or change something in the web.config file?

I feel?that this problem is in the permissions connecting Web?Service?to?SQL?Server?2005.I give you some suggestions for your reference as the following:
Try to add Network Service in the virtual directory permissions of IIS and make sure the execute permissions is Scripts and Executables through?right mouse clicking the virtual directory?and?choosing?properties?in?IIS.