//assign datatable to viewstate.
ViewState["dtQues"] = dtQue;
DataTable dt1 = (DataTable)ViewState["dtQues"];
Wednesday, March 31, 2010
Tuesday, March 30, 2010
HOw to add pager style...
1) Allow Paging =true
2) allow sorting=true.
NextPageText="Next " PreviousPageText="Previous" />
protected void gvrListOfStudent_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvrListOfStudent.PageIndex = e.NewPageIndex;
gvrListOfStudent.DataBind();
}
2) allow sorting=true.
protected void gvrListOfStudent_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvrListOfStudent.PageIndex = e.NewPageIndex;
gvrListOfStudent.DataBind();
}
Wednesday, March 10, 2010
How to pass two values two query string
window.location="ViewMemberDetails.aspx?view_id="+memberid+"&mem_no="+memberno;
Saturday, March 6, 2010
How to automatic REFRESH webpage after few seconds.
Just add Meta tag b4 / after HTML tag on web page.
//** meta http-equiv="Refresh" content="5" ** //
//** meta http-equiv="Refresh" content="5" ** //
How to fill DROPDOWN LIST on row data bound
protected void Page_Load(object sender, EventArgs e)
{
conn.Open();
da = new SqlDataAdapter("Select User_id,Name,EmailId,City_id,Qualification from tbl_user", conn);
da.Fill(ds,"tbl_User");
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.Columns[3].Visible = false;
conn.Close();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.Header)
{
DropDownList drdp1 = new DropDownList();
drdp1 = (DropDownList)e.Row.Cells[4].FindControl("drdp");
//int user_id =Convert.ToInt32(e.Row.Cells[1].Text);
DataSet ds1 = new DataSet();
SqlDataAdapter da1 = new SqlDataAdapter("Select City_name,City_id from tbl_city", conn);
da1.Fill(ds1, "tbl_drdp");
drdp1.DataSource = ds1;
drdp1.DataTextField = ds1.Tables[0].Columns["City_name"].ColumnName.ToString();
drdp1.DataValueField = ds1.Tables[0].Columns["City_id"].ColumnName.ToString();
drdp1.SelectedIndex = Convert.ToInt32(e.Row.Cells[3].Text);
drdp1.DataBind();
}
}
catch(Exception ex)
{
ex = ex;
}
}
{
conn.Open();
da = new SqlDataAdapter("Select User_id,Name,EmailId,City_id,Qualification from tbl_user", conn);
da.Fill(ds,"tbl_User");
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.Columns[3].Visible = false;
conn.Close();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.Header)
{
DropDownList drdp1 = new DropDownList();
drdp1 = (DropDownList)e.Row.Cells[4].FindControl("drdp");
//int user_id =Convert.ToInt32(e.Row.Cells[1].Text);
DataSet ds1 = new DataSet();
SqlDataAdapter da1 = new SqlDataAdapter("Select City_name,City_id from tbl_city", conn);
da1.Fill(ds1, "tbl_drdp");
drdp1.DataSource = ds1;
drdp1.DataTextField = ds1.Tables[0].Columns["City_name"].ColumnName.ToString();
drdp1.DataValueField = ds1.Tables[0].Columns["City_id"].ColumnName.ToString();
drdp1.SelectedIndex = Convert.ToInt32(e.Row.Cells[3].Text);
drdp1.DataBind();
}
}
catch(Exception ex)
{
ex = ex;
}
}
Saturday, February 20, 2010
New SEND-MAIL Function
protected void Button1_Click(object sender, EventArgs e)
{
try
{
MailMessage message = new MailMessage();
SmtpClient mailClient = new SmtpClient();
MailAddress frm = new MailAddress(txtmailfrom.Text);
message.To.Add(txtmailto.Text);
message.Subject = txtsubject.Text;
String bodyText = "";
bodyText = " ";
bodyText = bodyText + "Dear" + " " + "firstname" + " " + "lastname" + ",";
bodyText = bodyText + "
";
bodyText = bodyText + "
";
bodyText = bodyText + "Administrator has sent reply on your Registration:";
bodyText = bodyText + " " + "" + txtsubject.Text + "";
bodyText = bodyText + "
";
bodyText = bodyText + "RegistrationDate:";
bodyText = bodyText + " " + "" + DateTime.Now.ToString() + "";
bodyText = bodyText + "
";
bodyText = bodyText + "If you have any queries or want to send nominations, please mail the same to
href='mailto:YOURADMNEMAILID'>YOURADMNEMAILID " + "
";
bodyText = bodyText + "
";
bodyText = bodyText + "All the best!!";
bodyText = bodyText + "
";
bodyText = bodyText + "
";
bodyText = bodyText + "Regards,";
bodyText = bodyText + "
";
bodyText = bodyText + "WEBSITE";
bodyText = bodyText + "";
message.Body = bodyText.ToString();
message.IsBodyHtml = true;
message.Priority = MailPriority.High;
NetworkCredential basicAuthenticationInfo = new NetworkCredential(@"YOURGMAILID", "G-MAIL PWD");
mailClient.Host = "smtp.gmail.com";
mailClient.Port = 587;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.UseDefaultCredentials = false;
mailClient.EnableSsl = true;
mailClient.Credentials = basicAuthenticationInfo;
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
//mailClient.Timeout = 60000;
mailClient.Send(message);
lbl_success.Text = "Successsssss";
}
catch(Exception ex)
{
lbl_success.Text = "faillllll.";
}
}
{
try
{
MailMessage message = new MailMessage();
SmtpClient mailClient = new SmtpClient();
MailAddress frm = new MailAddress(txtmailfrom.Text);
message.To.Add(txtmailto.Text);
message.Subject = txtsubject.Text;
String bodyText = "";
bodyText = " ";
bodyText = bodyText + "Dear" + " " + "firstname" + " " + "lastname" + ",";
bodyText = bodyText + "
";
bodyText = bodyText + "
";
bodyText = bodyText + "Administrator has sent reply on your Registration:";
bodyText = bodyText + " " + "" + txtsubject.Text + "";
bodyText = bodyText + "
";
bodyText = bodyText + "RegistrationDate:";
bodyText = bodyText + " " + "" + DateTime.Now.ToString() + "";
bodyText = bodyText + "
";
bodyText = bodyText + "If you have any queries or want to send nominations, please mail the same to
href='mailto:YOURADMNEMAILID'>YOURADMNEMAILID " + "
";
bodyText = bodyText + "
";
bodyText = bodyText + "All the best!!";
bodyText = bodyText + "
";
bodyText = bodyText + "
";
bodyText = bodyText + "Regards,";
bodyText = bodyText + "
";
bodyText = bodyText + "WEBSITE";
bodyText = bodyText + "";
message.Body = bodyText.ToString();
message.IsBodyHtml = true;
message.Priority = MailPriority.High;
NetworkCredential basicAuthenticationInfo = new NetworkCredential(@"YOURGMAILID", "G-MAIL PWD");
mailClient.Host = "smtp.gmail.com";
mailClient.Port = 587;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.UseDefaultCredentials = false;
mailClient.EnableSsl = true;
mailClient.Credentials = basicAuthenticationInfo;
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
//mailClient.Timeout = 60000;
mailClient.Send(message);
lbl_success.Text = "Successsssss";
}
catch(Exception ex)
{
lbl_success.Text = "faillllll.";
}
}
Diffrence between FUNCTIONS AND STORED PROCEDURES
1. Functions are compiled and executed at run time.
Stored procedures are stored in parsed and compiled format in the database.
A Function returns 1 value only. Procedure can return
multiple values (max 1024).
Procedure can return zero or n values whereas function can return one value which is mandatory.
sp takes input,output parameters, function takes only
input parameters.
Functions are basically used to compute values. We passes some parameters to functions as input and then it performs some
operations on the parameter and return output.
Stored procedures are basically used to process the task.
Functions can be called from procedure whereas procedures cannot be called from function.
Function do not return the images, text. Stored Procedure returns all
Stored procedures are stored in parsed and compiled format in the database.
A Function returns 1 value only. Procedure can return
multiple values (max 1024).
Procedure can return zero or n values whereas function can return one value which is mandatory.
sp takes input,output parameters, function takes only
input parameters.
Functions are basically used to compute values. We passes some parameters to functions as input and then it performs some
operations on the parameter and return output.
Stored procedures are basically used to process the task.
Functions can be called from procedure whereas procedures cannot be called from function.
Function do not return the images, text. Stored Procedure returns all
Subscribe to:
Posts (Atom)