Bienvenidos

Recuerda que tus comentarios son importantes y recuerda agradecer si te fue útil algun artículo publicado aquí.

L1f3 15 a D@nc3 Flo0r

sábado, 8 de diciembre de 2007

Adding Images to a ReportViewer Report

An image is a report item that contains a reference to an image that is stored on the report server, embedded within the report, or stored in a database. An image can be a logo or picture that appears once on the report or it can be a picture that is repeated with rows of data. You can also use an image as a background for certain report items. You can get images from the following sources:

  • Database
  • External file share or Web site
  • Embedded locally within the report

You cannot use image files that have been added to a project.

Data-bound images can be displayed from binary data stored in a database. For example, the pictures that appear alongside product names in a product list are database images.

External images are specified as a URL that points to an image file. External images work well for logos and static pictures that are shared among several reports or Web pages.

Local report images are embedded in the report and then referenced. The image data is stored within the report definition and does not exist as a separate file. Embedded images ensure that the images are always available to the report, but they cannot be shared. Embedding an image increases the size of the report definition file. When you embed an image, Report Designer MIME-encodes the image and then stores it as text in the report definition.

How to add an Embedded Image to a Report

  1. Open the client report definition (.rdlc) file in graphical design mode.
  2. From the Report menu, select Embedded Images and add all of the images that you want to use in the report. If the Report menu is not available, click within the report design area.
  3. Drag the image control from the toolbox to the report layout. You must use the image control that is used for ReportViewer reports.
  4. Select the image and then open the Properties window in Visual Studio.
  5. Set Source to Embedded.
  6. Set Value to an image that is embedded in the report definition. You can choose which image to use from a drop-down list.

Using an External or Database Image to a Report

To use a database image, you can specify the database field that contains the image as long as the MIME type is JPG, PNG, or BMP. If the image is stored as a binary object, you must write an expression that converts the image to a supported type.

Using external images in a ReportViewer report is not enabled by default. To use an external image, you must set the EnableExternalImages property in your code. Depending on your network configuration, you might also need to bypass proxy settings to allow the external image to appear. You can add the following settings to the Web.config file to bypass the local proxy. When modifying your Web.config file, be sure to specify the name of the proxy server that is used in your network:

<system.net>

<defaultProxy>

<proxy usesystemdefault = "false"

bypassonlocal = "true"

proxyaddress = "http://<
proxyservername
>:80/" />

<defaultProxy>

</system.net>

Background Images

You can use an image as a background image in the body of the report or in a rectangle, text box, list, matrix, or table. A background image has the same properties as an image. You can also specify how the image is repeated to fill the background of the item.

Note

If you define a background image for the report body, but not the page header or footer, HTML reports will automatically use the same background image in all three regions of the report. If you do not want to use the background image in the header or footer, you must explicitly define a different image for those regions. If you do not want any image to appear in those regions, you can create and assign a small transparent image to the header or footer to create the effect of having no image at all.

To add a background image, do the following:

  • Open the client report definition (.rdlc) file in graphical design mode.
  • Select the report item to which you want to add a background image.

Note

Background images apply only to rectangle, text box, table, matrix, list, or report body items.

  • In the Properties window, expand BackgroundImage, and then do the following:
    • For Source, select External, Embedded, or Database.

Note

To use an image from the project, select External.

  • For Value, type or select an expression that evaluates to the source of the image.

    If the Source property is set to External, the expression must evaluate to a valid path to an image. This can be a static path to an image hosted on a report server, or it can be a path based on a field. If the image is stored in the project, type the name of the image as it appears in the project.

    If the Source property is set to Embedded, the expression must evaluate to the name of an image that is embedded in the report. If the Source property is set to Database, the expression must evaluate to a field that contains binary image data.

  • For MIMEType, select the appropriate MIME type for the image.

Note

MIMEType applies only if the Source property is set to Database. If the Source property is set to External or Embedded, the value of MIMEType is ignored.

For BackgroundRepeat, select Repeat, NoRepeat, RepeatX, or RepeatY.

miércoles, 28 de noviembre de 2007

Poner el numero de secuencia en un GridView

Para esto agregamos un template field

Y luego ponemos este código en el mismo

<asp:TemplateField>

<ItemTemplate>

<%# Container.DataItemIndex + 1 %>

</ItemTemplate>

</asp:TemplateField>

viernes, 2 de noviembre de 2007

Habilitar el registry cuando te sale el msg de que no puede entrar al registry porque ha sido desabilitado por el administrador

Registry Editing has been disabled by your administrator

The way to get into registry editing is simple. Open your start menu click Run and paste in the following command: REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f

domingo, 23 de septiembre de 2007

Prueba de Blog desde Word

Esta es una nueva funcionalidad de MS Word que te permite escribir el articulo desde este y lo postea en tu blog automaticamente

Cheers!

sábado, 22 de septiembre de 2007

Objeto conexion con AppSettings

en la pagina
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("Connstr"));

en el webconfig
appSettings
add key="Connstr" value="Data Source=.;Initial Catalog=EvalPortales;User ID=[dbusr]"/
/appSettings

nota: poner los <> en cada linea en la parte de webconfig


Tomar el valor de objetos dentro de un datalist

Si necesitamos hacer por ejemplo un cuestionario donde las preguntas vengan desde una base de datos, pero cada pregunta tenga un RadioButtonList para seleccionar una respuesta X, debemos usar un Datalist para desplegar todo,.. pero como tomamos el valor de cada RadioButton en cada pregunta??

//recorremos el datalist
for (int x = 0; x < DataList1.Items.Count; x++)
{
//buscamos los radiobutton dentro del datalist y lo asignamos a un objeto radiobutton creado por nosotrosRadioButtonList rbl = (RadioButtonList)DataList1.Items[x].FindControl("RadioButtonList1");
//asignamos el valor a una variable
string radio = rbl.SelectedValue.ToString();
}

entonces con la variable "radio" podemos hacer lo que querramos.


Thankx to Ing. Raul Roa

miércoles, 15 de agosto de 2007

Reemplazar caracteres por otros en SQL

Para reemplazar un caracter por otro en sql server
la clausula utilizada es REPLACE

uso: REPLACE(cadena1, cadena2, cadena3)

cadena 1 = es el campo donde esta lo que queremos reemplazar
cadena 2 = es el string que queremos reemplazar
cadena 3 = es el string por el que vamos a reemplazar el anterior

ej: REPLACE('jose-benzan', '-', '@')

resultado = jose@benzan

En un query seria:

select replace(Concepto,'BALANCE PENDIENTE', 'CUENTAS POR COBRAR') from BalancePendiente

y para actualizar los valores de un campo:

update BalancePendiente
Set Concepto = replace(Concepto,'BALANCE PEDIENTE', 'CUENTAS POR COBRAR')