Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Saturday, March 24, 2012

Delete Local Client File?

I have this upload utility that we created here at the office and I wanted to know if there is a way I can add a delete function to delete the uploaded file from the clients workstation (client side) from AJAX. We are trying to eliminate duplicate files on workstations and our web server. I created a WinForms control but it needs to have .net 2.0 configuration made to the security of every worksation so it ended up being a nightmare. Is there any other methods or tools I can use to accomplish this?

-rich

From ASP.NET or client side you cannot access the files in the client machine, sorry, you'll need to create an Active X for that
yea, kind of figured that - What's the best method in Visual Stuido 05? I've used vb 6 last time I had to create one but that was so long ago I have no idea where to begin...
You can use C++ in VS2005. A good start point is herehttp://msdn2.microsoft.com/fr-fr/library/zbwca5s6(VS.80).aspxHope this helps

Delete key not working with Firefox and FilteredTextBoxExtender

I'm using FilteredTextBoxExtenders for my textboxes with filtertype set to numeric. Everything works fine in IE but in Firefox, the delete key and arrow keys will not work in the textbox. Backspace key does work. This is a problem if the user needs to change the contents of the textbox after somethng has been entered. Is this a bug, is there a fix?

I'm also having this problem, has anybody found a solution to it?

Thanks


Just wondering if a solution had been found, as I'm struggling with this too, and it's not too well documented on the web

Wednesday, March 21, 2012

Delete Image from slideshow

Hi there,

I have copied the slideshow example and modified it to suit my purposes. I am stuck however on a problem.

I want to be able to press a button and delete an image from the slideshow. I know how to create the delete statement I just don't know how to get the value from the image into the statement.

Im using XML to store the location information of the images

<?xml version="1.0" encoding="utf-8"?>
<customer>
<header>
</header>
<slides>
<slide imagePath="\AjaxShaneSite\SlideShow\images\Blue hills.jpg" name="1" description="This is blue" />
<slide imagePath="\AjaxShaneSite\SlideShow\images\sunset.jpg" name="2" description="sunset" />
<slide imagePath="\AjaxShaneSite\SlideShow\images\water lilies.jpg" name="4" description="water lillies" />
<slide imagePath="\AjaxShaneSite\SlideShow\images\winter.jpg" name="5" description="winter...." />

</slides>
</customer>

Name equals the images ID.

This is my webmethod for the slide show

public partial class _Default : System.Web.UI.Page
{
// protected System.Web.UI.WebControls.DropDownList DropDownList1;
// Get the SQL Connection string from the web.config.
public String strConnectSQL = (ConfigurationSettings.AppSettings["csMain"]);

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static AjaxControlToolkit.Slide[] GetSlides()
{
XmlDocument myXML = new XmlDocument();
myXML.Load("H:\\AjaxShaneSite\\Slides.xml");
int i = 0;
AjaxControlToolkit.Slide[] temp = new AjaxControlToolkit.Slide[myXML.SelectSingleNode("/customer/slides").ChildNodes.Count];
foreach (XmlNode xNode in myXML.SelectSingleNode("/customer/slides").ChildNodes)
{
temp[i] = new AjaxControlToolkit.Slide(
xNode.Attributes["imagePath"].Value,
xNode.Attributes["name"].Value,
xNode.Attributes["description"].Value);
i++;
}
return temp;
}

Can anyone suggest some way for me to get the value from the image that is currently been displayed within the show?

Any help would be great!

Thanks

Shane

You can set the behavior id on the slideshow and retrieve the image element and get the source from that.

Something like this:

var slideshowbehavior = $find('slideshowbehavior1');

var image = slideshowbehavior.get_element();

var imageurl = image.src;


Sorry to be sounding daft here but where do I place this code?

Think I need a dummies guide to .NET & AJAX


In a client side function that responds to the slide changed event.

Check out this post:http://forums.asp.net/thread/1627419.aspx. It talks about getting the current slide.


Hi again,

Sorry I am really battling with this one.

I have a form that is in a master page. I have add your script to my page but nothing happens.

This is my update.

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ItemDetails.aspx.cs" Inherits="_Default" Title="RMH - Item Details" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <script type="text/javascript">function addSlideShowHandlers() {// hook into the slide show change eventvar slideshow = $find("slideShowBehavior1");slideshow.add_slideChanged(setCurrentSlide);}function setCurrentSlide(sender, eventargs) {var label = $get('label1');label.innerText = eventargs.ImagePath; }</script> <table style="width: 100%; height: 100%" onload="addSlideShowHandlers()"> <tr> <td style="width: 10%;"> </td> <td style="width: 35%;"> </td> <td style="width: 55%;"> </td> <td style="width: 10%;"> </td>
....
...
..
<cc1:slideshowextenderid="slideshowextend1"runat="server"autoplay="true"imagedescriptionlabelid="imageLabel1"BehaviorID="slideShowBehavior1"loop="true"nextbuttonid="nextButton"playbuttonid="playButton"playbuttontext="Play"previousbuttonid="prevButton"slideshowservicemethod="GetSlides"stopbuttontext="Stop"targetcontrolid="Image1"></cc1:slideshowextender>

</td><tdstyle="width: 55%;">

</td><tdstyle="width: 10%;"></td></tr></table>

Copyright

<br/>

</

asp:Content>

Any ideas?


I was having the same problem you are having and finally realized that since I am using Master Pages, I have to put the <bodyonload="addSlideShowHandlers()"> statement in the body tag on the Matser Page. Once I did that, it worked like a charm.

Hope that helps.


I've seen a number of threads such as this one discussing how to retrieve the current slide from the extender. I need to set the current slide so that the slide show begins from a designated index inside the slides array.

I am developing a rudimentary understanding of using behaviorID to hook into the various methods inside the javascript used to implement the extender but don't yet have enough of an understanding of what I'm seeing to figure out how to pass an index in and have the slideshow initialize at that point in the array rather than the beginning.

Any assistance is greatly appreciated!


For people using masterpages and trying the onload you might need to register the onload even in your child page. Make sure in your master page you've got the body tag set to runat="server" and give it an id="yourname". The example code below uses the body tag ID ="MainBody".

(inside the childpage's Page_Load event)

HtmlGenericControl body = (HtmlGenericControl)Page.Master.FindControl("MainBody");

body.Attributes.Add("onload","LoadBase()");

---

Doin the above means you will not have to register the code in your masterpage.

Delete confirmation in GridView and Ajax

Hi, I'm performing an upgrade from a traditional asp.net 2.0 web site to asp.net ajax.

I could perform all the necessary upgrades in my application to work with ajax, but one: how can I ask the user (using a ok/cancel dialog) if he/she wants to delete some gridview row? (assuming I use a traditional "delete command column" in the grid)

1. I tried to set this up using triggers... but could not find a way to halt execution with a custom script an resume execution if users says "ok"

2. I tried to build a custom extender... but all I could do is "intercept clicks" on the gridview, not "when it happens in a delete command" (everywhere I click on the grid fires the popup)

if someone could point any resource I can look at or any clue...

thanks a lot,

Victor

here is the code

Protected Sub gv_Project_RowDataBound(ByVal senderAs Object,ByVal eAs GridViewRowEventArgs)Handles gv_Project.RowDataBoundIf e.Row.RowType = DataControlRowType.DataRowThen Dim lAs LinkButton =CType(e.Row.Cells(5).Controls(0), LinkButton)' 5 is your column count of delete column l.Attributes.Add("onclick","javascript:return " & "confirm('Are you sure you want to delete this record " & DataBinder.Eval(e.Row.DataItem, "Project_Name").ToString() & "')")End If End Sub
 
 
cheers 

thanks a lot!!!

this is really a much simpler task as I was wondering...

thanks again,

regards

Victor


Hello,

Thanks for this tip.

I have a GridView with both Deleting and Editing enabled.

My Code sets the e.Row.Cells index to 0 so that refers to the Gridview Command column.
Dim lAs LinkButton =CType(e.Row.Cells(1).Controls(0), LinkButton)

In this case the Confirmation if triggered on a click of Edit and not Delete.

I would appreciate and suggestion how to attach the confirmation to the "Delete" Link in the GridView Command Column.

Thanks Lex


Hello, I have solved this issue by creating 2 command buttons, one for the Edit and One for the Delete.

This then allowed the reference to the Link Button to index the Delete Cell or Column.

Thanks Lex


Thanks, working perfectly

Delete and edit in ReorderList

Hi.

Is is possible to delete and edit the listitems in the ReorderList? Any examples of this?


thanks

-T

I have created the DeleteCommand event in the reorderList.. It looks like

protected void ReorderList1_DeleteCommand(object sender, ReorderListCommandEventArgs e)
{
this.ReorderList1.Items.Remove(e.Item);
}

But how do I trigger this event?
I could add a "linkbutton"(or something else) in the itemtemplate, but this obviously doesn't send an ReorderListCommandEventArgs, so I dont know what item in the list i selected..


Anyone?


Hi,

You just need to set the CommandName property of the LinkButton to "delete" to fire this event.


Thanks!

That worked.
I implemented the ItemCommand, instead of the DeleteCommand as I wrote earlier. Then I could do both editing and deleting with the same event:

protected void ReorderList1_ItemCommand(object sender, ReorderListCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
//Code for deleting the item
}

if (e.CommandName == "Edit")
{
//Code for editing the item
}
}


Got a new problem now...

When i want to save after editing, I use the following code:

if (e.CommandName.Equals("Save"))
{
List<myReorderListItem> list = (List<myReorderList>)Session["data"];

TextBox tb = (TextBox)e.Item.FindControl("tbEdit");
myReorderListItem m = new myReorderListItem();

m.Title = tb.Text;
m.Priority = e.Item.ItemIndex + 1;

list.RemoveAt(e.Item.ItemIndex);
list.Insert(e.Item.ItemIndex, m);

ReorderList1.EditItemIndex = -1;
myReorderList.saveDataToSession(list);
}

It finds the textbox control, but tb.Text is the same text that was in the textbox, before I edited it...

How can I get the "new/edited" text? (What actually is in the textbox)


alert(document.getElementById('tbEdit').value); returns the right value, but I wasn't planning on doing any javascript on this page..

tried this.Page.FindControl("tbEdit") also, but that also returns the textbox with the Text before it was edited!

delete ajax Extender with Javascript

hi

I have a problem with AutoCompleteExtender.

the code in HTML

<tr id="trUserName">
<td>
<asp:TextBox runat="server" id="txtUserName" />
<ajax:AutoCompleteExtender id="aceUserName" runat="server" TargetControlId="txtUserName"..... />
</td>
</tr>

when I run script below, it has errors.

var node = document.getElementById('trUserName');
node.parentNode.removeChild(node);

I have tried, if <tr /> tag without any Extender Control, it can be removed.

and I have to remove control in javascript.

Can you help me ?

Hi Benelf,

I think the best way for your situation is put them inside a div container. When you want to delete it, you can hide the div. For example,

<tr id="trUserName">
<td>

<div id="automCompleteContainer">
<asp:TextBox runat="server" id="txtUserName" />
<ajax:AutoCompleteExtender id="aceUserName" runat="server" TargetControlId="txtUserName"..... />

</div>
</td>
</tr>

To hide it , you can do it like this. document.all.automCompleteContainer.style.display ="none";

If you insist on deleting them, I suggest that you should first dispose() the AutoCompleteExtender by using $find("AutoCompleteExtender's BehavoirID").dispose().

I hope this help.

Best regards,

Jonathan