Showing posts with label control. Show all posts
Showing posts with label control. Show all posts

Tuesday, March 27, 2012

Default Image URL in DataList control!

Hey,

I have two questions:

1- In my page there should be a list of all system users, each of them may have an image or may not.

So what I need to do is how to make the next SQL query return a default ImageURL - e.g. "noAvator.jpg" - in case of null image value?

SELECT UserName , image, notes
FROM Members

2- When I try to write an image url in the SQL Server 2005 Management Studio - as "images/noAvator.jpg" or any other name - it always through me this error messagebox:

The changed value is not recignized as valid.
.NET Framework Data Type: Byte[]
Error Message: You can not use the Result pane to set this Field data to value other than NULL.

Why is that? is there a problem with the format of typing the image url?

I appreciate your help!

I'm not sure why you're receiving that error, but how about doing this within your ASPX page instead? If you are displaying your users in some type of GridView, then simply modify the data-binding expression for your image like so:

<asp:imageid="Image1"runat="server"imageurl='<%# (Eval("image") == DBNull.Value) ? "images/noAvator.jpg" : Eval("image") %>'/>

|||

ecbruck:

I'm not sure why you're receiving that error, but how about doing this within your ASPX page instead? If you are displaying your users in some type of GridView, then simply modify the data-binding expression for your image like so:

<asp:imageid="Image1"runat="server"imageurl='<%# (Eval("image") == DBNull.Value) ? "images/noAvator.jpg" : Eval("image") %>'/>

Hiecbruck,

Thanks for you reply,
Just for records, can you give me an example of image type format?

|||

You really shouldn't be using image as a column name, especially not quoted since image is a reserved datatype. Considering that the error message is complaining of trying to convert to a byte array, this leads me to believe that something is getting confused and thinking that you are talking about an actual image. Assuming the image column is of a varchar, or nvarchar datatype, then you can also change your query to be:

SELECT ISNULL(MyColumnNotNamedImage,'images/noAvator.jpg') FROM ...

|||

Motley:

You really shouldn't be using image as a column name, especially not quoted since image is a reserved datatype. Considering that the error message is complaining of trying to convert to a byte array, this leads me to believe that something is getting confused and thinking that you are talking about an actual image. Assuming the image column is of a varchar, or nvarchar datatype, then you can also change your query to be:

SELECT ISNULL(MyColumnNotNamedImage,'images/noAvator.jpg') FROM ...

Thanks alot, Motley!

Friday, March 9, 2012

decimal separator

Hi

Im experimenting with the reportViewer control in a .net 2.0 winform application, and I'm having a little problem: I can find no way to change the decimal separator(or the thousand separator) of a column of numbers in a table. I have tried all sorts of Format(), formatNumber() and FormatCurrency(). I've also tried to explicitly set the CurrentCulture of the application to a new cultureinfo object, and I've tried to change the culture of the datasets that the reports are base on.

Also, when calling the FormatCurrency() the output allways shows $ even though I find no trace of using USD anywhere in my system.

Any constructive hints out there?

Than you in advance,

Snorre

In ReportViewer control properties you can change Language property and that will change format for number, date, currency ...
|||

Thanks for your reply. Although I can't find the Language property anywhere: In the property page, in the intellisence, on the LocalReport object or anywhere else. Are you using the winform version of the control? Are there different versions of the control? I'm using the one shipping with visual studio.

Thanks.

Snorre

|||

I finally figured this out.

There was a Language property as suggested, not on the controller, but on the textbox(and table/matrix/chart) element in the report. What confused me though was that this box was overridden when using something like:

=format(sum(Fields!myfield.Value),"#,###.00")

To correct this I had to put the format string in the property field instead, and remove the formatting from the formula. Hope this helps someone...

Snorre

Sunday, February 19, 2012

debugging in SSIS

I have a script task in SSIS package. I want to debug the code . but even after setting break points control does not go through the code. So am using msgbox for debuggin purpose ( but its really painfull) can anybody guide me on this.

Thanks,

Prash

first I suggest posting to the SSIS forum

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

Second, this absolutely should be working.

With the VSA designer opened, f9 to set a breakpoint on some code.

when the package executes (from within the design environment, executing outside the designer will not bring up a jit type debugger) the breakpoint should hit.

If you continue to see this problem, post to the SSIS forum to see if anyone can think of things to try.

|||Moving to the right forum|||

prashant550806 wrote:

I have a script task in SSIS package. I want to debug the code . but even after setting break points control does not go through the code. So am using msgbox for debuggin purpose ( but its really painfull) can anybody guide me on this.

Thanks,

Prash

It isn't possible at the moment.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=359859&SiteID=1|||Just a minor point of clarification - you can debug script tasks (in the Control Flow), but you can't debug script components (in the Data Flow). I'm guessing from your problem that you are trying to debug a script component, not a script task.|||

I have tried both script task in control flow as well as script component in data flow but wasnt successful

regards,

Prash

|||

its pitty that SSIS does not support debug mode in script component/task...

Prash

|||

Phil Brammer wrote:

prashant550806 wrote:

I have a script task in SSIS package. I want to debug the code . but even after setting break points control does not go through the code. So am using msgbox for debuggin purpose ( but its really painfull) can anybody guide me on this.

Thanks,

Prash

It isn't possible at the moment.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=359859&SiteID=1

Phil,

That's not true. It is not possible to debug script components but it IS possible to debug script tasks - which is what the original poster said he wanted to do.

-Jamie

|||

prashant550806 wrote:

its pitty that SSIS does not support debug mode in script component/task...

Prash

It does. You CAN debug script tasks - as is stated elsewhere in this thread.

-Jamie