how to hide url in status bar

1.

<a href=”http://www.websitename.com/?parm=12” onMouseOver=”window.status=’http://www.websitename.com’;return true” onMouseOut=”window.status=””>Click here </a>

 

2.

<script language=”javascript” type=”text/javascript”>     function redirect(URL)     {       document.location=URL;       return false;     }    </script>

<a href=”http://www.websitename.com” onclick=”returnredirect(‘http://www.websitename.com/?parm=12′);”>Click here</a>

A potentially dangerous Request.Form value

This error occurs when we try to post html code from code behind.
The reason behind it server always validate the posted data, if it find that its an HTML code, error will occues like ‘A potentially dangerous Request.Form value…’.

if you want to send html data then you hvae to write {validateRequest=”false”} in page directive
ex:

AutoEventWireup=”true” ValidateRequest=”false”

pass multiple query string using HyperLinkField in Gridview

You can pass single/multiple query string using HyperLInkField

Pass data field name in DataNavigateUrlFields which you wnat to pass value in query string
ex:

DataNavigateUrlFields=”subject,query”

here subject and query both are differenct data field those are comming from database.

and write the page name in DataNavigateUrlFormatString where you want to pass query string value.

ex:

DataNavigateUrlFormatString = “~/Pages/default.aspx?UserName={0}&GameTitle={1}”

asp:HyperLinkField HeaderText=”View Details” DataNavigateUrlFields=”subject,query” DataNavigateUrlFormatString = “~/Pages/default.aspx?UserName={0}&GameTitle={1}” Text=”View”

Show Image from SQL Server in ASP.NET Using C#

Show Image from SQL Server in ASP.NET Using C#

SqlConnection objConnection;
SqlCommand objCommand;
SqlDataAdapter objAdapter;
DataSet objDS=new DataSet();

using (objConnection = new SqlConnection(“server=sujitkumar\\sqlexpress;database=livechat;uid=sa;pwd=1234″))
{
objConnection.Open();
using (objCommand = new SqlCommand())
{
objCommand.Connection = objConnection;

objCommand.CommandType = CommandType.Text;
objCommand.CommandText = “select img_online from image_master”;

objAdapter = new SqlDataAdapter(objCommand);
objAdapter.Fill(objDS, “CustomerAttributes”);
}
objConnection.Close();
}

MemoryStream stream = new MemoryStream();
byte[] image = (byte[])objDS.Tables[0].Rows[0][0];
Response.ContentType = “image/jpeg”;
Response.Expires = 0; Response.Buffer =true;
Response.Clear();
Response.BinaryWrite(image);
Response.End();

The above code will write image on the page.

You can show this image in any image button or image control like: