Code for updating gridview asp.net
'Sub rowUpdate(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GridView1.RowUpdating
' Response.Write(e.NewValues(0) & " rowindex" & e.Keys("projectManagerId")) ' newValues(0) is the first non Readonly column to be updated
' Using connection As New OdbcConnection(ConfigurationManager.ConnectionStrings("GeoConnectionString").ConnectionString)
' connection.Open()
' Using command As New OdbcCommand("UPDATE projectManager SET name ='" & e.NewValues(0) & "', Initials ='" & e.NewValues(1) & "', Active =" & e.NewValues(2) & " WHERE projectManagerId =" & e.Keys("projectManagerId"), connection)
' Using dr As OdbcDataReader = command.ExecuteReader()
' dr.Close()
' End Using
' End Using
' connection.Close()
'End Using
' End Sub
Code for reading xls spreadsheet into asp.net
' Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" Data Source=E:filepath\filename.xls;" "Extended Properties="Excel 8.0;"
'You must use the $ after the object you reference in the spreadsheet
' Dim myData As New OleDbDataAdapter("SELECT * FROM [SheetName$]", strConn)
' myData.TableMappings.Add("Table", "ExcelTest")
' myData.Fill(myDataset)
' you can set to auto generate columns or if you need to format columns you can generate them yourself (this code will generate them not autogenerate)
' Dim x As Int16
' For x = 0 To myDataset.Tables(0).Columns.Count - 1
' Dim myboundColumn As New BoundColumn
' myboundColumn.DataField = myDataset.Tables(0).Columns(x).ToString
' myboundColumn.HeaderText = myDataset.Tables(0).Columns(x).ToString
' setup formating on the columns
' If x > 1 Then
' myboundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Right
' Else
' myboundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center
' End If
' myboundColumn.DataFormatString = "{0:N0}"
' DataGrid1.Columns.Add(myboundColumn)
' Next
'
' DataGrid1.DataSource = myDataset.Tables(0).DefaultView
'
' DataGrid1.DataBind()"
code to update control styles
'ControlName.Style("text-align") = "Right"
Code to Redirect to Same page. Great for Fixing Master Page switching of Language Code Thread.
Page.Response.Redirect(Page.Request.Url.ToString(), True)
Code to use on MSsql for username duplicate if the username field is a unique key.
If (InStr(Err.Description.ToString, "Violation of UNIQUE KEY") <> 0) Then
ErrorMsg.Text = "Error: Duplicate Username pick another username
"
Else
end if
image rollover
create hyperlink and image tag
<asp:hyperlink id="Link1" runat="server"> <asp:image id="Image1" runat="server"></asp:image></asp:hyperlink>
in codefile
Image1.ImageUrl = "/images/driggs.gif"
Image1.Attributes.Add("name", Image1.ClientID)
Link1.NavigateUrl = "#"
Link1.Attributes.Add("onMouseOver", Image1.ClientID & ".src='/images/image2.gif'; window.status='Mouse Over'; return true;")
Link1.Attributes.Add("onMouseOut", Image1.ClientID & ".src='/images/image1.gif'; window.status=' '; return true;")
Access database to bind data
Using connection As New OdbcConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
connection.Open()
Using command As New OdbcCommand("SELECT projectName, CONCAT(projectNumber, '|', projectName) as projectNumberName from projectsheet ", connection)
Using dr As OdbcDataReader = command.ExecuteReader()
comboStates.DataSource = dr
comboStates.DataBind()
dr.Close()
End Using
End Using
connection.Close()
End Using
Find a control in a master content page
Dim mpContentPlaceHolder As ContentPlaceHolder
Dim mpTextBox As TextBox
mpContentPlaceHolder = CType(Master.FindControl("ContentPlaceHolder1"), ContentPlaceHolder)
If Not mpContentPlaceHolder Is Nothing Then
mpTextBox = CType(mpContentPlaceHolder.FindControl("textboxIDName"),TextBox)
If Not mpTextBox Is Nothing Then
mpTextBox.Text = "TextBox found!"
End If
End If
find a control
For Each ctl2 As Control In mpContentPlaceHolder.Controls
Response.Write("Controlid = " & ctl2.ID & "
")
Next
Bind a check box to a data grid.
<asp:templatecolumn HeaderText="Column Name">
< itemtemplate>
< asp:CheckBox ID="CheckBox1" runat="server" checked='<%# DataBinder.Eval(Container.DataItem, "DatabaseFieldName") %>' />
</itemtemplate>
</asp:templatecolumn>
Create table code for MSSQl
create table login
(
uid int IDENTITY(1,1) PRIMARY KEY,
FirstName varchar(15),
LastName varchar(20),
userName varchar(30) UNIQUE,
password varchar(30),
address varchar(30),
city varchar(20),
state varchar(20),
email varchar(100) UNIQUE);
ALTER TABLE login ADD company varchar(100);
ALTER TABLE Names
DROP CONSTRAINT UniqueValues;
ALTER TABLE Names
ADD CONSTRAINT UniqueValues
UNIQUE (FirstName, LastName);
MSSql Update Statements
update TABLE set Field = ('value') where field = 'value'
add list item
ProcessorCheckBox.Items.Add(New ListItem(oDR("myProcessor"), oDR("myProcessor")))
Check to see if reader has rows else throw exception
If Not myData.HasRows Then Throw New Exception("There are no Religion Data for this Country")
'Setup new control
Dim FamilyImage = New Image
FamilyImage.ImageUrl = "/photos/fp/familyfishing.jpg"
PlaceHolder1.Controls.Add(FamilyImage)
Change string to date in database
select cast(shipmentdate as datetime) as myshipdate
// setup phonenumber format
Dim strInput As String = Reader("PhoneNumber")
Dim strTemp As String = "(" ' "("
strTemp = strTemp & Left(strInput, 3) ' Area code
strTemp = strTemp & ") " ' ") "
strTemp = strTemp & Mid(strInput, 4, 3) ' Exchange
strTemp = strTemp & "-" ' "-"
strTemp = strTemp & Right(strInput, 4) ' 4 digit part
Phone.Text = strTemp
Data grid format a column DataFormatString="{0:(###)-###-####}" Column type must be numeric
Mysql Join Tables when the second or third table does not have any data returns null values for the table but still finds records in
the first table.
Select projectSheet.* from projectsheet
left join company on projectsheet.client1id = company.companyid
left join person on projectSheet.contactid= person.personid
where projectSheet.projectNumber = & CSProjectNumberText.Text
'Find Dup Records
select email, count(email) as newemail from customer group by email having newemail > 1
w3 Schools VB Reference
Distance Mapping for Runs
code to add to close a window.
' add attribute to close window when cancel button is clicked
CancelButton.Attributes.Add("onclick", "window.close();")
Or use the postbackurl PostBackUrl="javascript:window.close()"
add the following in the code behind click to also update the parent page
Response.Write("<script> window.opener.document.forms[0].submit(); window.close();</script>") or
Response.Write("<script> window.opener.location.reload();window.resizeTo(1024,768); window.close();</script>")
'ASP.net codefile open postbackurl in new window.
' set the postback url to open in new window
CreateComparison.OnClientClick = "document.forms[0].target='_blank';"
' make sure all the other buttons on that page open in same window
' postbackurl must be explicitly defined on all buttons for this to work properly.
addCategoriesBtn.OnClientClick = "document.forms[0].target='_self';"
AddAllCategoriesBtn.OnClientClick = "document.forms[0].target='_self';"
RemoveCategoriesBtn.OnClientClick = "document.forms[0].target='_self';"
RemoveAllCategoriesBtn.OnClientClick = "document.forms[0].target='_self';"
AddSelectedBtn.OnClientClick = "document.forms[0].target='_self';"
AddAllBtn.OnClientClick = "document.forms[0].target='_self';"
RemoveSelectedBtn.OnClientClick = "document.forms[0].target='_self';"
RemoveAllBtn.OnClientClick = "document.forms[0].target='_self';"
limit records in mssql
Select top 2 * from table
Overture keyword selector
Calendar Object
MSDN Asp.net Library
Dev Hood Tutorials
Win Named Colors
ASP.net Tutorial
JavaScript
Visually Mapping Data using ASP.net
GDI +
C-Sharp Tutorial
c-sharp pie chart generator
Asp.net membership system
Asp.net membership system
Asp.net Login validation
Asp.net Mapping Software for GIS Data
Asp.net Tutorials
Asp.net Design Templates
Localization
Diacriticals
Asp.net Forum
Spanish Dictionary
French Dictionary
en-US English
fr-FR French
de-DE German
he-IL Hebrew
ja-JP Japanese
es-MX Spanish (Mexican)
uk-UA Ukrainian (Ukraine)
Check out the chartgenerator.aspx code in the rsvbsdk directory for a way to stop
images from being displayed.?
http://msdn.microsoft.com/asp.net/learning/learn/newtodevelopment/
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introwebforms.asp
http://www.microsoft.com/globaldev/default.mspx
http://msdn2.microsoft.com/en-us/library/system.web.httpcookiecollection(VS.80).aspx
http://www.codeproject.com/aspnet/CatalogViewPhotoGallery.asp Review this code for ideas about how to create a better gallery of pictures
with a background and slide show.
http://www.datawebcontrols.com/classes/aspnet2/
http://msconline.maconstate.edu/tutorials/aspnet20/default.htm
Reserve America 877.444.6777
Wasatch State Park 785.3563
Here is the list of websites that Mike has for various of our ancestors.
Tolman:
http://tolmanfamily.org/thomas/main.asp
Holbrook:
http://www.holbrook-family.com/
Norway:
Norwegian Historical center (links to census, parish records etc.)
http://draug.rhd.isv.uit.no/indexeng.html
Search in parish registers (in English)
http://www.rhd.uit.no/kirkebok/kirkebok_sok_e.aspx
Digital archives:
http://digitalarkivet.uib.no/cgi-win/WebFront.exe?slag=vis&tekst=meldingar&spraak=e
Norwegian word list:
http://www.familysearch.org/Eng/Search/RG/frameset_rg.asp?Dest=G1&Aid=&Gid=&Lid=&Sid=&Did=&Juris1=&Event=&Year=&Gloss=&Sub=&Tab=&Entry=&Guide=WLNorway.ASP
Ringebu geneology (Anna Larsen's birth place)
http://onshus.no/index.htm
Us in the Ringebu geneology list:
http://onshus.no/html/wc158/wc158_485.htm
Ringebu church
http://www.stavechurch.no/eng/index.asp
MS Sql alter table to add a unique constraint to a fieldname
ALTER TABLE tablename ADD CONSTRAINT IX_fieldName UNIQUE(fieldName)