All Codes

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View All Codes as PDF for free.

More details

  • Words: 1,591
  • Pages: 17
Data Grid:

<SelectedItemStyle BackColor="#000099" FontBold="True" ForeColor="White" /> <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" NextPageText="Next" PrevPageText="Prev" />
Visible="false" Text='<%#DataBinder.Eval(Container.DataItem,"serialno")% rel="nofollow">'>


C# code: using System.Data.SqlClient; using System.Text; using System.IO; SqlConnection con = new SqlConnection("server=69.50.193.144;database=a1liberty;uid=admina1liber ty;pwd=fitzart2-"); protected void Page_Load(object sender, EventArgs e) { con.Open(); Bind(); } public void Bind() { SqlCommand cmd = new SqlCommand("select * from application", con);

SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "application"); grid1.DataSource = ds; grid1.DataBind(); } protected void grid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { grid1.CurrentPageIndex = e.NewPageIndex; Bind(); } protected void grid1_ItemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "select") { TableCell c = (TableCell)e.Item.Controls[0]; Session["asd"] = ((Label)c.Controls[1]).Text; //Session["prop"] = ((Label)c.Controls[1]).Text; Response.Redirect("applicantdetails.aspx"); } if (e.CommandName == "update") { TableCell c = (TableCell)e.Item.Controls[0]; Session["asd"] = ((Label)c.Controls[1]).Text; Response.Redirect("applicationupdate.aspx"); } if (e.CommandName == "delete") { TableCell c = (TableCell)e.Item.Controls[0]; string s = ((Label)c.Controls[1]).Text; SqlCommand cmddelete = new SqlCommand("delete from application where serialno='" + s.ToString() + "'", con); cmddelete.ExecuteNonQuery(); Page.RegisterStartupScript("asd", "<script>alert('Details deleted successfully')"); Bind(); } }

Data List:

<SelectedItemStyle BackColor="#9471DE" FontBold="True" ForeColor="White" />













C# code: using System.Data.SqlClient;

protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("server=69.50.193.144;database=a1liberty;uid=admina1liber ty;pwd=fitzart2-"); con.Open(); SqlCommand cmd = new SqlCommand("select * from application where serialno='" + Session["asd"] + "'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "application"); DataList1.DataSource = ds; DataList1.DataBind(); }

To get an ID automatically: int count = 0; SqlConnection con = new SqlConnection("server=69.50.193.144;database=a1liberty;uid=admina1liber ty;pwd=fitzart2-"); con.Open(); SqlCommand nw = new SqlCommand("select max(serialno) from application",con); SqlDataReader dr = nw.ExecuteReader(); dr.Read(); if (dr[0].ToString()=="") { count = 1000; } else { count = Convert.ToInt32(dr[0].ToString()) + 1; } dr.Close(); Copy the following code into your HEAD tags.

<script language="JavaScript">
function getDays(month, year) { // Test for leap year when February is selected. if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) || (0 == year % 400) ? 29 : 28; else return daysInMonth[month]; } function getToday() { // Generate today's date. this.now = new Date(); this.year = this.now.getFullYear() ; // Returned year XXXX this.month = this.now.getMonth(); this.day = this.now.getDate(); } function newCalendar() { var parseYear = parseInt(document.all.year [document.all.year.selectedIndex].text); var newCal = new Date(parseYear , document.all.month.selectedIndex, 1); var day = -1; var startDay = newCal.getDay(); var daily = 0; today = new getToday(); // 1st call if ((today.year == newCal.getFullYear() ) && (today.month == newCal.getMonth())) day = today.day; // Cache the calendar table's tBody section, dayList. var tableCal = document.all.calendar.tBodies.dayList; var intDaysInMonth = getDays(newCal.getMonth(), newCal.getFullYear() ); for (var intWeek = 0; intWeek < tableCal.rows.length; intWeek++) for (var intDay = 0; intDay < tableCal.rows[intWeek].cells.length;

intDay++) { var cell = tableCal.rows[intWeek].cells[intDay]; // Start counting days. if ((intDay == startDay) && (0 == daily)) daily = 1; // Highlight the current day. cell.style.color = (day == daily) ? "red" : ""; if(day == daily) { document.all.todayday.innerText= "Today: " + day + "/" + (newCal.getMonth()+1) + "/" + newCal.getFullYear(); } // Output the day number into the cell. if ((daily > 0) && (daily <= intDaysInMonth)) cell.innerText = daily++; else cell.innerText = ""; } } function getTodayDay() { document.all[element_id].value = today.day + "/" + (today.month+1) + "/" + today.year; //document.all.calendar.style.visibility="hidden"; document.all.calendar.style.display="none"; document.all.year.selectedIndex =100; document.all.month.selectedIndex = today.month; } function getDate() { // This code executes when the user clicks on a day // in the calendar. if ("TD" == event.srcElement.tagName) // Test whether day is valid. if ("" != event.srcElement.innerText) { var mn = document.all.month.selectedIndex+1;

var Year = document.all.year [document.all.year.selectedIndex].text; document.all[element_id].value=event.srcElement.innerText+"/"+mn +"/" +Year; //document.all.calendar.style.visibility="hidden"; document.all.calendar.style.display="none"; } } function GetBodyOffsetX(el_name, shift) { var x; var y; x = 0; y = 0; var elem = document.all[el_name]; do { x += elem.offsetLeft; y += elem.offsetTop; if (elem.tagName == "BODY") break; elem = elem.offsetParent; } while (1 > 0); shift[0] = x; shift[1] = y; return x; } function SetCalendarOnElement(el_name) { if (el_name=="") el_name = element_id; var shift = new Array(2); GetBodyOffsetX(el_name, shift); document.all.calendar.style.pixelLeft = shift[0]; // document.all.calendar.offsetLeft; document.all.calendar.style.pixelTop = shift[1] + 25 ; }

function ShowCalendar(elem_name)

{ if (elem_name=="") elem_name = element_id; element_id = elem_name; // element_id is global variable newCalendar(); SetCalendarOnElement(element_id); //document.all.calendar.style.visibility = "visible"; document.all.calendar.style.display="inline"; } function HideCalendar() { //document.all.calendar.style.visibility="hidden"; document.all.calendar.style.display="none"; } function toggleCalendar(elem_name) { //if (document.all.calendar.style.visibility == "hidden") if(document.all.calendar.style.display=="none") ShowCalendar(elem_name); else HideCalendar(); } --> <style> .today {COLOR: black; FONT-FAMILY: sans-serif; FONT-SIZE: 10pt; FONTWEIGHT: bold} .days {COLOR: navy; FONT-FAMILY: sans-serif; FONT-SIZE: 10pt; FONTWEIGHT: bold; TEXT-ALIGN: center} .dates {COLOR: black; FONT-FAMILY: sans-serif; FONT-SIZE: 10pt} Copy the following code into the BODY of your html page.

Calendar




<SCRIPT language=JavaScript> // Output days. for (var intLoop = 0; intLoop < days.length; intLoop++) document.write(""); <SCRIPT language=JavaScript> for (var intWeeks = 0; intWeeks < 6; intWeeks++)

{ document.write(""); for (var intDays = 0; intDays < days.length; intDays++) document.write(""); document.write(""); }

Related Documents

All Codes
November 2019 9
Qr Codes -all
June 2020 5
Codes For All Phones
October 2019 16
Nokia All Codes
May 2020 3
All India Rto Codes
April 2020 15
Ifsc Codes Of All Banks
November 2019 56