Showing posts with label line. Show all posts
Showing posts with label line. Show all posts

Wednesday, March 28, 2012

connection to Web Service Refused

I created a simple webservice on my local system. I then created the proxy on the command line (Services.cs).
I wrote a Console App to use the webservices. Added a reference to System.Web.Services And did a right click Add --> Existing Item --> Services.cs

Anonymous Access is set on IIS.

The failure I get is:
Unhandled Exception: System.Net.WebException: Unable to connect to the remote server --> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.

I tried setting (in the WebService) Dynamic Port to false. After I did this, it worked the first time, but since then has the same error as above.

OS: Windows XP Pro

Any thoughts would be appreciated.

Thanks, Jason

It might be worth while posting this in the Web services or WCF forums

.NET 2.0 ASMX Web Services: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=46&SiteID=1

WCF: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=118&SiteID=1


Thanks, i will do that.

J

Saturday, March 24, 2012

Confirm GridView row delete with ModalPopup

Hi,

I have a GridView with a delete Button on each line, to delete that row. This works fine usingCommandName="Delete" propertyon the button and theRowDeleting Event on the GridView.

What I want is to use the ModalPopup to make a delete confirmation, but, I can't put this to work. The RowDeleting Event doen's work anymore.

What should I do?

This is the code:

<ItemTemplate> <asp:ImageButton ID="ibDelete" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="../../UserFiles/Images/ico_del.gif" ToolTip="delete row"/> <asp:Panel ID="pnlPopUp" runat="server" Style="display: none" CssClass="modalPopup"> <asp:Panel ID="pnlDragPopUp" runat="server" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black"> <div> <p>Are you sure you want to delete this item?</p> </div> </asp:Panel> <div> <p style="text-align: center;"> <asp:Button ID="OkButton" runat="server" Text="Yes" /> <asp:Button ID="CancelButton" runat="server" Text="Cancel" /> </p> </div> </asp:Panel> <ajax:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="ibDelete" PopupControlID="pnlPopUp" BackgroundCssClass="modalBackground" OkControlID="OkButton" CancelControlID="CancelButton" DropShadow="true" PopupDragHandleControlID="pnlDragPopUp" /> </ItemTemplate>
 The GridView Event:
 
 
Protected Sub MyGridView_RowDeleting(ByVal senderAs Object,ByVal eAs GridViewDeleteEventArgs)Dim myConnetionAs SqlConnection =New SqlConnection(erpConn)Dim delCommandAs SqlCommand = myConnetion.CreateCommand() delCommand.CommandText ="myQuery" delCommand.Parameters.Add("@dotnet.itags.org.Adress", SqlDbType.NVarChar).Value = MyGridView.DataKeys(e.RowIndex).Values(0).ToString() myConnetion.Open() delCommand.ExecuteNonQuery() myConnetion.Close() GetUser()End Sub

Anyone?Crying


Hi Cseven,

Would you please remove theOkControlID="OkButton"

<ajax:ModalPopupExtender ID="ModalPopupExtender" runat="server"
TargetControlID="ibDelete"
PopupControlID="pnlPopUp"
BackgroundCssClass="modalBackground"
OkControlID="OkButton" //remove this item
CancelControlID="CancelButton"
DropShadow="true"
PopupDragHandleControlID="pnlDragPopUp" />

In your case, it won't post back, so that's cause the problem.

By the way, in your case , there are severalModalPopupExtenders and Panels in a page. It is cool but not an efficient way.

I hope this help.

Best regards,

Jonathan


the modalpopupextender takes control of its targetcontrol...so in your case the ibDelete button event, which fires the RowDeleting, is being overridden on the client

you have two options:

1) use the old hidden button hack and show your modalpopup programatically. Place another button right above your modalpopupextender and hide it via css...then set your modalpopupextender targetcontrolid to that button... now in your code-behind inside your gridview_rowcommand event...put a logic statement checking e.commandname ...if it equals "Delete" then call ModalPopupExtender.Show()...

2) create a webmethod that deletes the row manually and call it with the onokscript via the modalpopupextender