|
I am developing an e-commerce site, as part of my academic project. I want to integrate the Paypal. I am not familiar with it. Can we see and learn about transactions without having money in accounts? I want to simulate the transactions. Is there any option for that??
|
|
|
|
|
|
I have a few web applications that I maintain and I find myself very often writing the same block of code over and over again to bind a GridView to a data source. I'm trying to create a Generic method to handle data binding but I'm having trouble getting it to work with Repeaters and DataLists.
Here is the Generic method I have so far:
public void BindControl<T>(T control, SqlCommand sql) where T : System.Web.UI.WebControls.BaseDataBoundControl
{
cmd = sql;
cn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
control.DataSource = dr;
control.DataBind();
}
dr.Close();
cn.Close();
}
That way I can just define my CommandText then make a call to "BindControls(myGridView, cmd)" instead of retyping this same basic block of code every time I need to bind a grid.
The problem is, this doesn't work with Repeaters or DataLists. The error shown says "There is no implicit reference conversion from 'System.Web.UI.WebControls.Repeater' to 'System.Web.UI.WebControls.BaseDataBoundControl'." I can't seem to find the right base class that is in common with all 3 controls.
For now I have overloaded the method specifically for Repeaters and DataLists, but does anyone know what I could use instead of "BaseDataBoundControl" that would work for all three control types?
- Dave
|
|
|
|
|
Try implementing an Interface.
|
|
|
|
|
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[^]
|
|
|
|