
05/03/2009, 12:04
|
| | Fecha de Ingreso: enero-2009
Mensajes: 38
Antigüedad: 16 años Puntos: 0 | |
C# sentencia IF Hola espero alguien me pueda ayudar
soy nuevo en c# y estaba haciendo una aplicacion y quiero hacer que cuando mi combo sea seleccionado inmediatamente se active el checkboxlist a lo mejor y todo lo que puse esta mal pero quisiera que me ayudaran me urge
mi codigo es este en el aspx
<form id="form1" runat="server">
<div id="DIV1" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="DropDownList1_SelectedInde xChanged" >
</asp:DropDownList>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" AutoPostBack="True" >
</asp:CheckBoxList>
</div>
</form>
y en el aspx.cs es el siguiente
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Default5 : System.Web.UI.Page
{
private String Query;
private SqlConnection conn;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
conn = new SqlConnection("Data Source=femecpltp3b4589; database=Prueba; Integrated Security=True");
conn.Open();
Query = "Select inscripción from bol_inscripcion";
if (Query.Equals("inscripción"))
{
CheckBoxList1.Visible = true;
}
conn.Close();
}
}
gracias |