Dim cnn As New SqlConnection(ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString)
Response.Write(cnn.ConnectionString)
2º ConfigurationManager
System.Configuration.ConfigurationSettings.AppSettings["connstr"].ToString();
3º ConfigurationManager
ConfigurationManager.GetSection("prodSection")
4º ConfigurationManager
ConfigurationManager.GetWebAppSection("prodSection")
5º Agregar atributo a una fila de un GridView en Asp.Net:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");
}
}
6º Insertar código JS:
Dim script As New StringBuilder
script.Append("")
Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "MyScript", script.ToString)
7º Filtrar items que se van insertando en un Repeater control de Asp.Net:
Protected Sub Repeater1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemCreated Dim nav As XPathNavigator = CType(e.Item.DataItem, IXPathNavigable).CreateNavigator For Each o As Object In e.Item.Controls If TypeOf o Is HtmlAnchor Then Dim pagina As String = nav.Select("/Titulos/Titulo").Current.SelectSingleNode("pagina").Value If pagina = "Cursos" Then If User.Identity.IsAuthenticated Then Dim archivo As String = nav.Select("/Titulos/Titulo").Current.SelectSingleNode("archivo").Value o.Attributes.Add("href", "media/images/" + archivo) o.Attributes.Add("rel", "lightbox[roadtrip]") Else o.Attributes.Add("href", "/") o.Attributes.Add("class", "verModal") End If Else e.Item.Visible = False End If End If Next End Sub
No hay comentarios:
Publicar un comentario