hello,
I would like make a season for image to open new window in ASP.Net.
I am follwing this Display user data with picture (image) on AutoComplete selection using C# and Generic Handler in ASP.Net
C#
protected void Buttonrm0_Click(object sender, EventArgs e)
{
Session["Gender"] = RadioButtonList5.SelectedValue; //الموظف / المدير
Session["Gender2"] = RadioButtonList2.SelectedValue; // بداية نهاية
//total
Session["rsmonth0"] = rsmonth0.Text;
Session["rsmtotal0"] = rsmtotal0.Text;
//date
Session["rsmdate"] = TextBox18.Text; // التاريخ
Session["rsmtime"] = TextBox17.Text; // الوقت
//data user
Session["name"] = txtUsername.Text; // الاسم
Session["filenumber"] = filenumber.Text; // رقم الملف
Session["location"] = txtSearch2.Text; // الموقع
Session["markazel3mel"] = markazel3mel.Text; // القسم
Session["civilid"] = civilid.Text; // الرقم المدني
string url = "/Admin/rasmi.aspx";
string s = "window.open('" + url + "', 'popup_window', 'width=800,height=950,left=100,top=100,resizable=yes');";
ClientScript.RegisterStartupScript(this.GetType(), "script", s, true);
}
protected void Searchdata2()
{
try
{
String constring = ConfigurationManager.ConnectionStrings["kankonConnectionString"].ConnectionString;
SqlConnection sqlcon = new SqlConnection(constring);
String pname = "Insert_Userupdate2"; ;
sqlcon.Open();
SqlCommand com = new SqlCommand(pname, sqlcon);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("namelocation", txtSearch2.Text);
SqlDataReader rdr;
rdr = com.ExecuteReader();
if (rdr.Read())
{
txtSearch2.Text = rdr["namelocation"].ToString();
byte[] bytes = null;
System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
System.Drawing.Image img = (System.Drawing.Image)converter.ConvertFrom((byte[])rdr["filelocation"]);
using (MemoryStream ms = new MemoryStream())
{
img.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
bytes = ms.ToArray();
}
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
im1.ImageUrl = "data:image/png;base64," + base64String;
}
else
{
txtUsername.Text = "";
civilid.Text = "";
ClientScript.RegisterClientScriptBlock(GetType(), "alert", "alert('" + "no data\\n " + txtSearch2.Text.ToString() + "');", true);
}
sqlcon.Close();
}
catch (Exception)
{
}
}