Merging multiple TIFF files in one TIFF file using c#

private static void MergeTiff(string[] sourceFiles)
{
string[] sa = sourceFiles;
//get the codec for tiff files
ImageCodecInfo info = null;
foreach (ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders())
if (ice.MimeType == “image/tiff”)
info = ice;

//use the save encoder
Encoder enc = Encoder.SaveFlag;

EncoderParameters ep = new EncoderParameters(1);
ep.Param[0] = new EncoderParameter(enc, (long)EncoderValue.MultiFrame);

Bitmap pages = null;

int frame = 0;

foreach (string s in sa)
{
if (frame == 0)
{
MemoryStream ms = new MemoryStream(File.ReadAllBytes(s));
pages = (Bitmap)Image.FromStream(ms);

//save the first frame
pages.Save(s, info, ep);
}
else
{
//save the intermediate frames
ep.Param[0] = new EncoderParameter(enc, (long)EncoderValue.FrameDimensionPage);

try
{
MemoryStream mss = new MemoryStream(File.ReadAllBytes(s));
Bitmap bm = (Bitmap)Image.FromStream(mss);
pages.SaveAdd(bm, ep);
}
catch (Exception e)
{
LogError(e, s);
}
}

if (frame == sa.Length – 1)
{
//flush and close.
ep.Param[0] = new EncoderParameter(enc, (long)EncoderValue.Flush);
pages.SaveAdd(ep);

}

frame++;
}

}

In Asp.net check at least one checkbox is selected in CheckBoxList using Javascript

function Validate_Checkbox()
{
// GET CHECKBOXLIST OBJECT
var chks= document.getElementById(”);

var chkListinputs = chks.getElementsByTagName(“input”);
var hasChecked = false;
for (var i = 0; i < chkListinputs.length; i++)
{
if (chkListinputs[i].checked)
{
hasChecked = true;
break;
}
}
if (hasChecked == false)
{
alert("Please select at least one Plan!");

return false;
}

return true;

}

//Calling method
OnClientClick=”return Validate_Checkbox()”

Immediate Button Disable On Click – ASP.net/Javascript

note :immediate button Disable when click on button ..after your process complete button enable.

protected void Page_Load( object sender, EventArgs e)
{

btnname.Attributes.Add(“onclick”, @” this.value=””Processing…”” ;this.disabled = true; ” + this.Page.ClientScript.GetPostBackEventReference(btnname, null) + “;”);

}

protected void btnname_Click( object sender, EventArgs e)
{

//cause delay
System.Threading.Thread.Sleep(3000);

}

Data Table horizontal (side to side) Data Show in Vertical Direction (Up and Down) in GridView c#

public DataTable FlipDataTable(DataTable dt)
{
DataSet ds = new DataSet();
DataTable table = new DataTable();

for (int i = 0; i <= dt.Rows.Count; i++)
{
//First you create New Table Column
table.Columns.Add(Convert.ToString(i));
}
//Initilize Row
DataRow row;
for (int k = 0; k < dt.Columns.Count; k++)
{
//Create New Row
row = table.NewRow();
//Insert Data Into Row.
row[0] = dt.Columns[k].ToString();
for (int j = 1; j <= dt.Rows.Count; j++)
row[j] = dt.Rows[j – 1][k];
table.Rows.Add(row);
}

return table;
}
hope its help, This code is not totally my effort without google its not easy i think there is different ways to Filp Data but in my views its easy and understable.

Failed to access IIS metabase

 

followed below steps to resolve the issue –

 

1. Unregistered all the versions of ASP.NET with command “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis –ua”.

 

2. Deleted the ASPNET account from “Local Users and Group – Users”.

 

3. Then registered ASP.NET 2.0 with IIS using “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis –i”.

 

4. Gave permissions to the ASPNET account using “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis –ga machinename\ASPNET”.

 

5. Reset the IIS and that resolved the issue for ASP.NET 2.0.

 

6. We registered ASP.NET 1.1 with IIS as well using command “C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis –i”.

 

7. Reset the IIS.

 

 

 

After following the above steps we configured virtual directory versions as required and test both ASP.NET 1.1 and ASP.NET 2.0 application.

 

Everything worked fine as expected.