ラベル object の投稿を表示しています。 すべての投稿を表示
ラベル object の投稿を表示しています。 すべての投稿を表示

2012年3月28日水曜日

Re-Setting an Object to its original position using Animation Extender

Hi

I have been working on a nice ajax menu using the Animation Extender. Basically, i have a series of GIF's. When the mouse hovers over a gif, the gif moves 6px to the right. When the mouse hovers out, the gif moves 6px to the left.

Everything works well, if you let the whole animation run through. But if you where to move your mouse off and on the gif a few times in a short period, the gif would actually lose its original position and end up either further left or further right to where it should.

I spose what I am trying to get at is, is it possible to reset an objects original position?

Here is a sample of my extender:

<cc1:AnimationExtender ID="AnimationExtender3" runat="server" TargetControlID="btnPro">
<Animations>
<OnHoverOver>
<Move duration=".03" fps="50" horizontal="6" unit="px"/>
</OnHoverOver>
<OnHoverOut>
<Move duration=".03" fps="50" horizontal="-6" unit="px"/>
</OnHoverOut>
</Animations>
</cc1:AnimationExtender>

Thanks for your help in advance.

Hugh

Would any one have an easier way of doing this?

Thanks

Hugh


HI ,

try this link :

Scripting Animations from the Ms Ajax AnimationExtender

Hope this heps


Thanks for the link.

This would be perfect for wat i am trying to do. Problem is i cant seem to get it to work on a hover over event, instead of a click event.

Any ideas?

Thanks

Hugh

Response.Redirect

This is the code to redirect to a new page from a GridView...

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string SeqNo = "";
string dd = "";
int ix = GridView1.SelectedIndex;

if (ix >= 0)
{
SeqNo = GridView1.SelectedRow.Cells[4].Text;
dd = GridView1.SelectedRow.Cells[1].Text;
if ( (SeqNo.Trim() != "") && (dd.Trim() != "") )
Response.Redirect(String.Format("DocketOnline.aspx?DocketDate={0}&SeqNo={1}&cn={2}", dd, SeqNo, FCaseNo));
}
}

Prior to placing the GridView in an UpdatePanel, the code above worked fine. Now clicking on the Select column, triggering the code above, gives the error:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

How do I fix this?

All I want is to have GridView in an UpdatePanel so that paging is AJAXed...I also want the user to be able to select a command column to go to another page.

Thanks,

Jay

You would either have to:

1. on the RowDataBound register javascript to open a new window for the selected row event...

or

2. Just use a link button and set the url and targetpane properties in a column to open a new window or to navigate to the new page.

or - cancel the asynchpost prior to the redirect and then redirect (not sure this one will work though)...

Using the response.rediect in asynch the ScriptManger gets involved and things just get messy...because it intercepts everything and the response.redirect messes up the expected structure it is figuring on sending to the client for the partial page update..


Hi,

I have a user control which does not have script manager. In this user controll I input zipcode and it will populate the city state. This user control in on the main page along with other user controls. Script manager is on the main page. There is no script manager proxy. When I click on the button to populate the city state info it is populating it but whole page is refreshed instead of city and state which is inside the update panal. Does anyone have any idea whats causing this issue?

Regards,
Nepalaya


Response.Redirect should work fine during an async postback.

2012年3月26日月曜日

result from web service is what type/object?...

Hi ALL,

At first i was using older version of the AJAX toolkit and the Sys.Net.WebServiceProxy Class was not set. I was getting an error trying to run the posted samples...

Next, i got the latest RC version and updated my toolkit. So far, everything seems to be working great, except the part when the web service result comes back (in the OnSuccess method).

Following the samples, instead of the actual string result i see XML Object. I mean from a simple web method "HellowWorld() as string", instead of a string i see XML Object.

I tried alerting the result.xml, assuming it is of XMLDom object and that is what it is?... Should this be JSON parsed value vs actual XMLDom.

I mean if the webservice returned a stirng, result should be a string, if the web service returned an object with properties A and B, i should be able to access it like this: alert(result.A), and e.t.

Any thoughts will be appreciated!

Ivan

I am sure you all have seen and tried this:

http://ajax.asp.net/docs/Samples/Sys.Net.WebServiceProxy/vb/WebServiceProxy.aspx

In my case, instead of actual server time string for example for example i would see "[object]"...

This object returned is the XMLDom corresponding to the result which i could certainly use and go further with my development, but i am afraid that this may not be the right way. According to the documentation, the result should be the actual object returned from the web service, in this case a string...


You didn't happen to put a ScriptMethod attribute on your web service method to change the ResponseFormat from the default of JSON to XML, did you?

Retrieve JSON result set

What is the best method for retrieving a result set and returning a JSON object? I tried using a DataSet, but received a serialization error.

TIA

You do not have to do anything special to convert in JSON. The Asp.net Ajax Automatically handles it. But in case you want to some manual proessing use the JavaScriptSerializer.


You do not have to do anything special to convert in JSON. The Asp.net Ajax Automatically handles it. But in case you want to some manual proessing use the JavaScriptSerializer. The DataSet is not supported with the Current Version, Add the January CTP to work with DataSet and DataTable.


I am a little confused. Can you provide an example of how to retrieve a JSON serialized result set? Where do I find the January CTP?

TIA


You can find the January CTP from this linkhttp://www.microsoft.com/downloads/details.aspx?familyid=4CB52EA3-9548-4064-8137-09B96AF97617&displaylang=en

Retrieving an atlas control object from an html element

Ok I know you can get the HTML element an atlas control is tied to using the associatedElement property of a control object. I was wondering if there is a way in the framework of retrieving a control if you've got the HTML element?

Hi,

yes, you can use the control property. For example, if myElement is a reference to a DOM element that is associated to an Atlas control, you can write

myElement.control;
to get a reference to the Atlas control.

Brilliant, thanks for the help.

return a html table with ajax C#

hi

I am writing a website using C#, web services and ajax. I have my ajax web service call returning either an array or a DataTable object. Does anyone have any example of writing either one of these returned values to a html table using javascript?

thanks

C

It might help http://dotnetslackers.com/articles/ajax/ASPNETAjaxGridAndPager.aspx

2012年3月24日土曜日

Return json from xml document

I am trying to return a json object from an XML docuement, but the returned object is not in json format. What am i misisng?

<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, XmlSerializeString:=False)> _
PublicFunction GetFormObject( _
ByVal strFileLocAsString)As XmlDocument
Try
Dim xmlDocAsNew XmlDocument
xmlDoc.Load(strFileLoc)
Return xmlDoc
Catch allExceptionsAs Exception
MsgBox(HttpUtility.HtmlEncode(allExceptions.Message))
ReturnNothing
EndTry
EndFunction

TIA

Is the XmlDocument class marked as serializable? It needs to be in order to be remoted by JSON.


Hi Scott,

How does one mask an xml document as serializable?

Ron Tornambe


Hi,

I am not sure, but here may be the answer:http://forums.asp.net/p/1054378/1496599.aspx

I am not sure, did you try to specify content-type in request?

Content-Type: application/json

Here the request generated by AJAX.NET Beta 2 proxy, see 'js' before method name:

POST /Source/service.asmx/js/UpdateChat HTTP/1.1
Host: localhost:1123
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Content-Type: application/json
Content-Length: 50
Cookie: ASP.NET_SessionId=qpspnn45mgxzlp20xdj0dvng; .SLCVISITOR=200529225
Pragma: no-cache
Cache-Control: no-cache

{"a":246144119,"v":200529225,"n":18,"z":-1,"m":[]}

Thankfomine for providing the answer.

Best Regards


You can use theNewtonsoft.Json libary。

like this:

[WebMethod]
[ScriptMethod]
public string GetData()
{
XmlDataDocument doc =new System.Xml.XmlDataDocument();
doc.LoadXml("/test.xml");

using (StringWriter sw =new StringWriter())
{
using (JsonWriter jsonWriter =new JsonWriter(sw))
{
jsonWriter.Formatting = Newtonsoft.Json.Formatting.Indented;

JsonSerializer jsonSerializer =new JsonSerializer();
jsonSerializer.Converters.Add(new XmlNodeConverter());

jsonSerializer.Serialize(jsonWriter, doc);
}
return sw.ToString();
}

}

2012年3月21日水曜日

rounded corners control problem

Hi, I have tried this code:

<%@dotnet.itags.org. Page Language="C#" %>
<SCRIPT runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Image i = new Image();
Panel pl = new Panel();
PlaceHolder1.Controls.Add(pl);
pl.Controls.Add(i); pl.BorderColor = System.Drawing.Color.Blue;
pl.BackColor = System.Drawing.Color.Blue;
pl.ID = "pnl";
i.ID = "pppp";
i.ImageUrl = "../images/1/1.jpg";
i.Height = 200;
i.Width = 200;
pl.Height = 200;
pl.Width = 200;
AjaxControlToolkit.RoundedCornersExtender rce = new AjaxControlToolkit.RoundedCornersExtender();
PlaceHolder1.Controls.Add(rce);
rce.ID = "bleble";
rce.TargetControlID = pl.ID;
rce.Radius = 6;
}
</SCRIPT>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD id=Head1 runat="server">
</head>
<body>
<FORM id=form1 runat="server">
<DIV>
<?xml:namespace prefix = asp /><asp:ScriptManager id=ScriptManager1 runat="server">
</asp:ScriptManager>
<asp:PlaceHolder id=PlaceHolder1 runat="server"></asp:PlaceHolder>
</DIV>
</FORM>
</body>
</html>

For some reasons the result I got is the image inside a panel, with two blue thin rounded corners rectangles on the top of the image and on the bottom of it.
It didn't make rounded corner image. What is the problem of it? How can I display rounded corners image?

Why dont you try to create the conrol in the front end instead of the code behind.

use the following code that is on the sample and see it works fine. All you have to do is give the Id of the control!

http://www.asp.net/ajax/control-toolkit/live/RoundedCorners/RoundedCorners.aspx


I write my application in a way that for each aspx file there is aspx.cs file. I tried this 100 times and it didn't worked for me. Take the code I wrote and try it yourself. Does it show a rounded corner Image? For some reason, Images are not working for RoundedCornersExtender.

I am looking desperatly for an answer.