12-09-2023
- codigo para mapa
<!DOCTYPE html>
<html lang="es">
<head>
<title>Leaflet-Grayscale</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<style type="text/css">
.leaflet-tile-loaded {
filter: brightness(1) invert(1) grayscale(10);
}
.leaflet-container a {
color: #000000;
}
.leaflet-container .leaflet-control-attribution {
background: none;
background-color: #fff;
}
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').
setView([40.452173, -3.690662],
15);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href=""https://openstreetmap.org"">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
maxZoom: 18
}).addTo(map);
</script>
</body>
</html>
- mapas links
https://mappinggis.com/2018/03/como-anadir-mapas-base-en-qgis-3-0-openstreetmap-google-carto-stamen/
- & para agregar mas variables a la url por get
- Bootstrap: link rel="stylesheet" href="Content/bootstrap.min.css"
-
se agrega en el evento click del boton
String nombre,pass,user; nombre = ddlCategoria.SelectedValue; user = txtUsuario.Text; pass = txtPass.Text; if (user == "argentina" && pass == "123") { Response.Redirect("paginainicio.aspx?nom=" + nombre); } else { //Response.Write("Credenciales incorrectas"); string script = @"<script type='text/javascript'> alert('credenciales incorrectas'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); }
-
se agrega al evento load page
string nombre; nombre = Request.QueryString["nom"]; lblSaludo.Text = "Hola " + nombre;
-
creamos la variable de sesion desde la pagina de login
String nombre,pass,user; nombre = ddlCategoria.SelectedValue; user = txtUsuario.Text; pass = txtPass.Text; if (user == "argentina" && pass == "123") { //sesion Session["usuario"] = user; Response.Redirect("paginainicio.aspx?nom=" + nombre); } else { //Response.Write("Credenciales incorrectas"); string script = @"<script type='text/javascript'> alert('credenciales incorrectas'); </script>"; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false); }
-
capturamos la variable de sesion (load)
string nombre, user; nombre = Request.QueryString["nom"]; user = Session["usuario"] as string; lblSaludo.Text = "Hola " + nombre; lblUsuario.Text = user;
protected void Button1_Click1(object sender, EventArgs e)
{
ListBox1.Items.Add(txtAgregar.Text);
txtAgregar.Text = "";
}
protected void Button4_Click(object sender, EventArgs e)
{
ListBox2.Items.Add(ListBox1.SelectedValue);
ListBox1.Items.Remove(ListBox1.SelectedValue);
}
protected void Button5_Click(object sender, EventArgs e)
{
ListBox1.Items.Add(ListBox2.SelectedValue);
ListBox2.Items.Remove(ListBox2.SelectedValue);
}
protected void Button3_Click(object sender, EventArgs e)
{
for (int i = 0; i <= ListBox1.Items.Count - 1; i++)
{
ListBox2.Items.Add(ListBox1.Items[i].ToString());
}
ListBox1.Items.Clear();
}
protected void Button2_Click(object sender, EventArgs e)
{
for (int i = 0; i <= ListBox2.Items.Count - 1; i++)
{
ListBox1.Items.Add(ListBox2.Items[i].ToString());
}
ListBox2.Items.Clear();
}
protected void dplProductos_SelectedIndexChanged(object sender, EventArgs e)
{
txtPrecio.Text = dplProductos.SelectedValue;
}
protected void btnAgregar_Click(object sender, EventArgs e)
{
try
{
double precio, subtotal, acumulador;
acumulador = 0;
int cant;
String nombre;
precio = double.Parse(txtPrecio.Text);
cant = int.Parse(txtCantidad.Text);
nombre = dplProductos.SelectedItem.Text;
subtotal = precio * cant;
lbxProductos.Items.Add(nombre);
lbxPrecio.Items.Add(precio.ToString());
lbxCantidad.Items.Add(cant.ToString());
lbxSubotal.Items.Add(subtotal.ToString());
for (int i = 0; i <= lbxSubotal.Items.Count - 1; i++)
{
acumulador = acumulador + double.Parse(lbxSubotal.Items[i].ToString());
}
lblTotal.Text = acumulador.ToString();
txtCantidad.Text = "";
lblError.Text = "";
}
catch
{
//lblError.Text = "Ah ocurrido un error no debe haber campos vacios";
string script = @"<script type='text/javascript'>
alerta();
</script>";
ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, false);
}
}
protected void btnEliminar_Click(object sender, EventArgs e)
{
lbxCantidad.Items.Clear();
lbxPrecio.Items.Clear();
lbxProductos.Items.Clear();
lbxSubotal.Items.Clear();
lblTotal.Text = "";
txtCantidad.Text = "";
txtPrecio.Text = "";
}
protected void btnEliminaSeleccion_Click(object sender, EventArgs e)
{
int indexlbx;
double acumulador = 0;
indexlbx = lbxProductos.SelectedIndex;
if(indexlbx >= 0 && indexlbx < lbxProductos.Items.Count)
{
lbxCantidad.Items.RemoveAt(indexlbx);
lbxPrecio.Items.RemoveAt(indexlbx);
lbxProductos.Items.RemoveAt(indexlbx);
lbxSubotal.Items.RemoveAt(indexlbx);
}
for (int i = 0; i <= lbxSubotal.Items.Count - 1; i++)
{
acumulador = acumulador + double.Parse(lbxSubotal.Items[i].ToString());
}
lblTotal.Text = acumulador.ToString();
}
-
para obtener el texto usar SelectedItem
protected void ddlArtefacto_SelectedIndexChanged(object sender, EventArgs e) { lblPrecio.Text = ddlArtefacto.SelectedValue; String imagen; //para obtener el texto imagen = ddlArtefacto.SelectedItem.Text; imgArtefacto.ImageUrl = "~/imagenes/" + imagen + ".jpg"; }
protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e)
{
String nombre;
int index;
index = cblMeses.SelectedIndex;
nombre = "";
//List<string> meses = new List<string>();
foreach (ListItem item in cblMeses.Items)
{
if (item.Selected)
{
//meses.Add(item.Value);
nombre += item.Value + " - ";
}
}
//lblMes.Text = string.Join(" - ", meses);
lblMes.Text = nombre;
}
-
forma 2
lblMes.Text = ""; for(int i=0; i<=cblMeses.Items.Count - 1; i++) { if (cblMeses.Items[i].Selected) { lblMes.Text += cblMeses.Items[i].Value + "<br>"; } }
21-09-2023
-
para que funcionen los controles de validacion
-
se debe agregar en webconfig
<appSettings> <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /> </appSettings>
- tener en cuenta el typo maximo y minimo y el campo a validar
-el codigo va en el boton
protected void Button1_Click(object sender, EventArgs e)
{
//RangeValidator1.MinimumValue = Convert.ToDateTime(txtLlegada.Text).ToShortDateString();
//RangeValidator1.MaximumValue = Convert.ToDateTime(txtSalida.Text).ToShortDateString();
if(txtLlegada.Text != string.Empty)
{
RangeValidator1.MinimumValue = txtLlegada.Text;
RangeValidator1.MaximumValue = txtSalida.Text;
RangeValidator1.Validate();
}
}
<asp:AnimationExtender ID="lnkYellowFade_AnimationExtender" runat="server" Enabled="True" TargetControlID="lnkYellowFade">
<Animations>
<OnClick>
<Sequence>
<Color
AnimationTarget="message"
Duration="0"
Property="style"
PropertyKey="backgroundColor"
StartValue="#fff666"
EndValue="#ffffff" />
</Sequence>
</OnClick>
</Animations>
</asp:AnimationExtender>
-
Crear el style
<style type="text/css"> #Panel1 { position:absolute; padding:3px; background-color: #eeeeee; border:solid 1px black; } </style>
-
Extender en el panel la siguiente animación
<asp:AnimationExtender ID="Panel1_AnimationExtender" runat="server" Enabled="True" TargetControlID="Panel1"> <Animations> <OnLoad> <Sequence> <Move Horizontal="300" Vertical="300" Duration="1" Fps="20" /> <FadeOut Duration="1" Fps="20" /> </Sequence> </OnLoad> </Animations> </asp:AnimationExtender>