Feeds:
Posts
Comments

Archive for October, 2006

css for asp:GridView

.Grid { border: solid 1px #FFFFFF; }
.Grid td
{
border: solid 1px #FFFFFF;
margin: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
text-align: center;
}
.GridHeader
{
font-weight: bold;
background-color: #8b8dbb;
}
.GridItem
{
background-color: #e6e6e6;
}

.GridAltItem
{
background-color: white;
}

<asp:GridView ID=”grdPermitRequest” runat=”server” AutoGenerateColumns=”False” DataSourceID=”srcPermitRequest” Width=”100%” CssClass=”Grid”>
<HeaderStyle CssClass=”GridHeader”></HeaderStyle>
<AlternatingRowStyle CssClass=”GridAtlItem”/>
</asp:GridView>

Advertisements

Read Full Post »

CSS for ASP:HyperLink

.WhiteLink
{
color:#FFFFFF;
text-decoration: none;
font-weight:bold;
}
.WhiteLink:hover
{
background:#E6E6E6;
color:#000000;
text-decoration:none;
}

<asp:HyperLink ID=”lnkRequesList” runat=”server” NavigateUrl=”ViewRequestPage.aspx” CssClass=”WhiteLink”>Request Link</asp:HyperLink>

Read Full Post »

load dynamic user control in c#.net

take a placeholder on your page and the write this code on your event. ctlSudentAddress ctlAddress=(ctlSudentAddress)LoadControl(“ctlSudentAddress.ascx”);

ctlAddress.showStudentAddress(ID);

PlaceHolder1.Controls.Add(ctlAddress);

Read Full Post »

Paging in DataGrid

aspx datagrid tag 

<asp:DataGrid id=”dgProducts” runat=”server” AllowPaging=”True” OnPageIndexChanged=”GridPageChange” PageSize=”4″ />

Code Base 

If Not Page.IsPostBack Then
DataFiller()
End If

Sub DataFiller()
Dim strConnection As String = “data source=(local);initial catalog=University; user id=sa; password=janina;”
Dim objConnection As New SqlConnection(strConnection)

Dim strSqlProducts As String = “SELECT * FROM Users where UserName like ’06-%'”
Dim objAdapter As New SqlDataAdapter(strSqlProducts, objConnection)

Dim objDataSet As New DataSet
objAdapter.Fill(objDataSet, “dtProducts”)

dgProducts.PagerStyle.NextPageText = “Next”
dgProducts.PagerStyle.PrevPageText = “Previous”
dgProducts.DataSource = objDataSet.Tables.Item(“dtProducts”)
dgProducts.DataBind()
End Sub

Sub GridPageChange(ByVal S As Object, ByVal E As DataGridPageChangedEventArgs)
dgProducts.CurrentPageIndex = E.NewPageIndex
DataFiller()
End Sub

Read Full Post »

white these code to page_load so Radio Button List will be generated
Dim strConnection As String = “data source=(local);initial catalog=testDB; user id=sa; password=1234;”

Dim strSQLforListBox As String = “SELECT distinct FirstName, ID “
strSQLforListBox += “FROM Users”

Dim objConnection As New SqlConnection(strConnection)
Dim objCommand As New SqlCommand(strSQLforListBox, objConnection)

objConnection.Open()
radEmployees.DataSource = objCommand.ExecuteReader()
radEmployees.DataTextField = “FirstName”
radEmployees.DataValueField = “ID”
radEmployees.DataBind()
objConnection.Close()
 

Then we need to write the following codes in SelectedIndexChanged

Dim strConnection As String = “data source=(local);initial catalog=testDB; user id=sa; password=1234;”

Dim strSQLforGrid As String = “SELECT “
strSQLforGrid += ” FirstName, LastName, “
strSQLforGrid += “phone, PermanentAddress1 “
strSQLforGrid += “FROM Users “
strSQLforGrid += “WHERE ID= ” & radEmployees.SelectedItem.Value

Dim objConnection As New SqlConnection(strConnection)
Dim objCommand As New SqlCommand(strSQLforGrid, objConnection)

objConnection.Open()
DataGrid1.DataSource = objCommand.ExecuteReader()
DataGrid1.DataBind()
objConnection.Close()

Read Full Post »

SqlConnection in VB.NET

Dim strConnection As String = “data source=(local);initial catalog=testDB; user id=sa; password=1234;”
Dim objConnection As New SqlConnection(strConnection)

Dim strSQL As String = “SELECT * from tblTest;”
Dim objCommand As New SqlCommand(strSQL, objConnection)

objConnection.Open()

Response.Write(“ServerVersion: ” & objConnection.ServerVersion & _
vbCrLf & “Datasource: ” & objConnection.DataSource & _
vbCrLf & “Database: ” & objConnection.Database)

DataGrid1.DataSource = objCommand.ExecuteReader()
DataGrid1.DataBind()
objConnection.Close()

Read Full Post »

request response in vb .net

response goes like that

Response.Cookies(“name”).Value = TextBox1.TextResponse.Cookies(“pass”).Value = TextBox2.Text

Response.Redirect(“newForm.aspx”)

 Request takes such way

Label1.Text = Request.Cookies(“name”).Value & ” ” & Request.Cookies(“pass”).Value

Read Full Post »