|
I think that might be a little outside of my comfort zone, but I'll do some research on it. It might be a good learning experience if nothing else...
I was really hoping there would be some base class that I had just overlooked that would be inclusive of all three control types...
- Dave
|
|
|
|
|
You must "overload" your method.
In words, you write a method
with the same name several
times each taking differrent
args, something like
public void inABind(Gridview gv, DataSet ds)
{Put you code here}
public void inABind(DropDownList ddl, dataset ds)
{Put you code here}
public void inABind(WhateverControl wc, WhateverDataSource weds)
and on and on like that till
you cover all bases
|
|
|
|
|
That's what I've already done in my current solution. I was just looking for a common interface that would allow me to cover them all in one Generic method...
- Dave
|
|
|
|
|
overtech06 wrote: That's what I've already done in my current solution.
OOps sorry, I missed that in your original post.
|
|
|
|
|
overtech06 wrote: one Generic method...
Well you could use GetType() then a switch ...
protected void inaBind(Object a, Object c)
{
switch (a.GetType().Name)
{
case "GridView":
(a as GridView).DataSource = c as DataSet;
break;
case "Repeater":
(a as Repeater).DataSource = c as DataSet;
break;
}
}
|
|
|
|
|
I'm doing the following in a web page, and returning the results to a silverlight app:
Bitmap bmp = new Bitmap(60, 30);
MemoryStream ms = new MemoryStream();
bmp.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);
Byte[] buffer = new Byte[ms.Length];
ms.Read(buffer, 0, (int)(ms.Length));
Response.ContentType = "image/jpeg";
Response.BinaryWrite(buffer);
bmp.Dispose();
g.Dispose();
In the client, I'm doing this:
string url =
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
client.OpenReadAsync(new Uri(url));
<br /><br />
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
BitmapImage bi = new BitmapImage();
bi.SetSource(e.Result); <---- crashes here with a "catastrophic failure"
Image image = new Image();
image.Source = bi;
e.Result.Close();
e.Result.Dispose();
this.testImage.Child = image;
}
The e.Result property contains a 536-byte stream (which seems reasopnable given the size of the image), but it crashes in the indicated position. Does anyone know what I'm doing wrong?
Here's the exception I'm seeing:
{System.Exception: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))<br />
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)<br />
at MS.Internal.XcpImports.BitmapSource_SetSource(BitmapSource bitmapSource, CValue& byteStream)<br />
at System.Windows.Media.Imaging.BitmapSource.SetSourceInternal(Stream streamSource)<br />
at System.Windows.Media.Imaging.BitmapImage.SetSourceInternal(Stream streamSource)<br />
at System.Windows.Media.Imaging.BitmapSource.SetSource(Stream streamSource)<br />
at SLTestApp2.Home.client_OpenReadCompleted(Object sender, OpenReadCompletedEventArgs e)}
.45 ACP - because shooting twice is just silly----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Friday, April 30, 2010 10:27 AM
|
|
|
|
|
John Simmons / outlaw programmer wrote: Response.ContentType = "image/jpeg";
maybe image/gif would be better
|
|
|
|
|
Beyond the fact that it shouldn't matter, I'd already tried that...
The stream is getting back to the silverlight app, but it crashes when I call BitmapImage.SetSource() ...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I think somehow the Bytestream is corrupted or the Encoding is not perfect. Catastropic failure means somehow the bytestream cannot be set in the BitmapImage source.
I never used Silverlight, but in WPF I have used this, and it works correctly.
I think this would help you :
http://forums.silverlight.net/forums/p/94817/276293.aspx[^]
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
Nope, I'd already seen that...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Another thing if you need to show animated gif images you can use MediaElement to do that.
I think Animated gif can work only with mediaelement.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
No - it's just a static image.
An I actually got it working, but I don't know what I did to make it work...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
SilverLight BitmapImage does not support Gifs:
From: http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage(VS.95).aspx[^]
The BitmapImage can be used to reference images in the JPEG and PNG file formats.
So the best thing will be to stream them as PNG or JPEG.
MemoryStream ms = new MemoryStream();
bmp.Save(ms,System.Drawing.Imaging.ImageFormat.Jpeg);
Byte[] buffer = new Byte[ms.Length];
ms.Read(buffer, 0, (int)(ms.Length));
Response.ContentType = "image/jpeg";
Response.BinaryWrite(buffer);
bmp.Dispose();
g.Dispose();
Save the image as Jpeg and also change the content type to image/jpeg.
|
|
|
|
|
When i am adding an item to gridview i want set the screen view at that row. So i am add 100 th Item and if it goes outside the page then my page automatically gets a scrollbar and focus is on that item....How to do that?
Thanks for any help................
|
|
|
|
|
You can use the jQuery.ScrollTo method or
the window.scrollTo method.
|
|
|
|
|
Also consider this code ....
<html>
<body>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<br><br><br><br>
<a href=# name="there"></a>
hello ?
</body>
Now if the url of the page is "scrll.htm"
and you call the page like this ...
scrll.htm#there
the page will scroll to the "named anchor"
|
|
|
|
|
Hi,
My application is created using ASP.Net Web Application template.
I want script Manager to be added in one of my page.
I did the following to make My existing ASP.Net web application to Ajax enabled. But it is not working.
Installed ASPAJAXExtSetup.msi
added below config in web.config
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler" validate="false"/>
</httpHandlers>
<compilation defaultLanguage="c#" debug="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
When i am tring to add a <asp:ScriptManager runat="server" />
Under form tag , I am not getting this tag in intellisence.
Please help how I can add scriptManager to my existing ASp.net web application.
Thanks,
Salmon.
|
|
|
|
|
Looks like you forgot:
<add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
I would suggest you to create a new project that is AJAX Enabled(using AJAX Enabled template), and then just copy the Web.Config file from there in your project. After that you can add/update any other stuff like Appsetting section/Authentication/Authorization sections as it was earlier in your project.
|
|
|
|
|
|
I am Redirecting mypage to another page and passing username & password from Query string. I want hide them.
Actually i dont want to use Session, Cookies, Context, Server.Transfer and any other state management technique. I just want to use Querystring and want to hide it and also dont want to encrypt and decrypt Querystring.
Thanks for any help.....
|
|
|
|
|
Not asking much then, if you don't want to use the various things provided.
Think you should maybe rethink on why you don't want to use those topics, and what exactly you are wanting to achieve.
You can also try here for more info on various methods; http://tinyurl.com/383rkbo[^]
|
|
|
|
|
First of all passing password on your URL is bad, what ever way you do it.
If you wish to not use session/cookies/server.transfer then you are left with only querystring or the request.form objects.
As far as I know you cannot hide data from querystring, you can encrypt/decrypt it though, but you don't want to do it.
So, you have to go the classic ASP way and POST the data to the new page and get the data using request.form.
HTH!
|
|
|
|
|
sandympatil wrote: Actually i dont want to use Session, Cookies, Context, Server.Transfer and any other state management technique. I just want to use Querystring
You dont want ot use any other any other state management technique and just want ot use querystring.
AFAIK,There is no way to hide querystring parameter else you have to use another way.Better you can encrypt/decrypt if you have to stick with querystring.
Generally it is not recommendsed to use querystring for sensitive data like yours.
|
|
|
|
|
sandympatil wrote: just want to use Querystring and want to hide it
OOkay , here is what the "login"
page looks like...
</head>
<body>
<form action=''>
enter password<br>
<input type="password" name="password" >
<input type="submit" >
</form>
</body>
<script type="text/javascript">
xhr = new XMLHttpRequest();
myredirect = function () {
xhr.open("GET", "http://whoever.com/Default3.aspx?" + document.forms[0].password.value, true);
xhr.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.responseText == "failed") { alert("failed"); }
else {
window.location.replace(this.responseText);
}
}
}
xhr.send(null);
return false;
}
document.forms[0].onsubmit = myredirect;
</script>
</html>
hereis the aspx file ...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
here is the aspx.cs ...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString.ToString() == "password")
{
Response.Write("http://www.msn.com");
Response.End();
}
else
{
Response.Write("failed");
Response.End();
}
}
}
|
|
|
|
|
Thanks for Reply..........
|
|
|
|