web stats analysis

How to convert Html page to Pdf using asp.net (C#)?

HTML to PDF for using asp.net.

I have simple solution is bellow.

You just use below code and convert HTML to PDF.


protected void Page_Load(object sender, EventArgs e)

{

ArrayList ar_li = new ArrayList();

ar_li.Add(Cache["tester"]);

Cache.Remove("tester");

BinaryFormatter bnr_f = new BinaryFormatter();

MemoryStream mstrm = new MemoryStream();

bnr_f.Serialize(mstrm, ar_li);

CR_visitor_Pass cr_vi = new CR_visitor_Pass();

cr_vi.Load(Server.MapPath("~/CR_visitor_Pass.rpt"));

//MemoryStream oStream;    // using System.IO

//oStream = (MemoryStream) ar_li;

Response.Clear();

Response.Buffer = true;

Response.ContentType = "application/pdf";

Response.BinaryWrite(mstrm.ToArray());

Response.End();

}

How to create attractive button step by step?

Use of CSS3 for making attractive button.

Here I try and making a attractive button:

In HTML Document:


<div>
<a href="#">Click Here</a>
</div>

I create div having a link (Name:Click Here)..Add below css:


.button
{
background-color:#e1e1e6;
width:400px;
height:100px;
border:1px solid black;
border-radius:5px;
}

I only created a box here inside which I have to create a button.


.btnred
{
position:relative;
top:36px;
left:35%;
text-decoration:none;
color:#fff;
background:#cb2727;
text-align:center;
padding:20px 30px;
width:115px;
border-radius:5px;
border:solid 1px #ec3838;
transition: all 0.1s;
-webkit-box-shadow: 0px 9px 0px #a81515;   /*for opera and safari*/
-moz-box-shadow: 0px 9px 0px #a81515;     /*for mozilla*/
-o-box-shadow: 0px 9px 0px #a81515;      /*for opera*/
-ms-box-shadow: 0px 9px 0px #a81515;    /*for I.E.*/
}
I set text-decoration to none that’s why link underline is removed. After that, I set color and background-color. Then, I set text-align and padding. The important step here is transition and box-shadow.

CSS3 transitions are effects that let an element gradually change from one style to another.

Add below css:


.btnred:active
{
-webkit-box-shadow: 0px 2px 0px #a81515;
-moz-box-shadow: 0px 2px 0px #a81515;
-o-box-shadow: 0px 2px 0px #a81515;
-ms-box-shadow: 0px 2px 0px #a81515;
position:relative;
top:43px;
}

Note:-Active selector is use to select and style the active link.A link active when you click on it

This button working is that decrese box-shadow and muve the position slightly down so that appears pressing down

How to refresh a page after file upload?

File upload and page refresh in asp.net.

You can simply by below solution.

You simply add this below FileUp.SaveAs:
Response.Redirect(“mypage.aspx”);

‘mypage.aspx’ is the name of current aspx page.You can use responce redirect to refresh the page. If there are querystring variable then follow below.

Response.Redirect(“mypage.aspx” + Request.QueryString.ToString());

How to add arrow in wordpress menu ?

Add arrow on the sub menu with child elements in wordpress.

How can we add arrow on the sub menu with the child elements on the repsonsive theme?

I try and get simple solution:

You just add below script in your css where you want arrow in responsive menu.


.nav-menu li > a:after{

color: #888;

counter-increment:none;

content:  " \25BA";

}

.nav-menu li > a:hover:after {

color: #444;

content: " \25BA";

}

.nav-menu li > a:only-child:after {

content: '';

}

After adding script go to start -> run -> and type character map.

Character map using for choosing different different arrow purpose it’s like click below image.

Choose arrow and get the code of particular arrow here above image I make a round on code. Type this code into your content in script.

How to windows phone: navigation to the page in c# ?

Navigating Between Pages.

windows phone navigate to page,

Below several ways to pass data to another page:

Answer:1

1.You can use query parameters as Shawn suggested.
2.You can use global data stored somewhere like in app.cs
3.You can use a static class to hold the data.
4.You can use a shared viewModel to hold the parameters. (or static properties in the viewmodel)

Answer:2

You can also take help query parameters and NavigationEventArgs.You can use the NavigationEventArgs to define if the user is going forword or background by checking the NavigationModel.If you want to download by using the query parameters so can tell page 2.

Write the below code in page 1.


private void MoveToPage2FromPage1()

{

NavigationService.Navigate(new Uri("/Page2.xaml?shouldDownload=true", UriKind.Relative));

}

Write the below code in page 2.


protected override void OnNavigatedTo(NavigationEventArgs e)

{

  if (e.NavigationMode == NavigationMode.Back) return;

  string shouldDownload = "";   //May not be needed if you'll only ever go to page 2 from page 1 to download...

  if (NavigationContext.QueryString.TryGetValue("shouldDownload", out shouldDownload))

   {

      Convert.ToBoolean(shouldDownload);

   }

}

How to download file using C#?

A question which asked for a solution to download a file from a web server programmatically.
The simple solution code is below.

Using below code in button click event:



private void btndwn_file(object sender, EventArgs e)
{
string url = @"http://www.code.top10idea.com/wp-content/uploads/download_image.png";

// Create an instance of WebClient

WebClient client = new WebClient();

// Hookup DownloadFileCompleted Event

client.DownloadFileCompleted +=    new AsyncCompletedEventHandler(client_DownloadFileCompleted);

// Start the download and copy the file to c:\temp

client.DownloadFileAsync(new Uri(url), @"c:\temp\download_image.png");
}

void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("File successfully downloaded");
}

You can also download the file synchronously using WebClient.DownloadFile() method.

How to pass a Javascript Array via JQuery Post so that all its contents are accessible via the PHP $_POST array?

How to send an array via the url in javascript/jQuery?

If you want to pass a JavaScript object/hash (ie. an associative array in PHP) then you would do:

$.post(‘/url/to/page’, {‘key1′: ‘value’, ‘key2′: ‘value’});

If you wanna pass an actual array (ie. an indexed array in PHP) then you can do:

$.post(‘/url/to/page’, {‘someKeyName’: ['value','value']});

If you want to pass a JavaScript array then you can do:

$.post(‘/url/to/page’, {‘someKeyName’: variableName});

How to redirect to index.php after “login in using facebook connect”?

How to forward a website to another url?

Redirect to another web page using PHP.

Facebook redirect url to index.php

I try and get simple solution is bellow:

Answer:1

You could try into below config.php file.


$config['allow_get_array'] = TRUE;

$config['enable_query_strings'] = FALSE;

This is my controller and its work properly for me.


$myurl = "http://mysite.com/index.php";

redirect($this->facebook->getLoginUrl(array('scope' => 'email', 'redirect_uri' => $myurl)));
Answer:2
If users facebook connect first time then after if it redirects to member.php then follow below:

Change the default redirect URL.
Open modules\boonex\facebook_connect\classes\BxFaceBookConnectConfig.php
Look for this line.
$this -> sDefaultRedirectUrl = BX_DOL_URL_ROOT . ‘member.php’;
Change in to this.
$this -> sDefaultRedirectUrl = BX_DOL_URL_ROOT . ‘index.php’;

C# window application checkboxlist selection mode one not working.

CheckedListBox.SelectionMode Property.

Simple solution is bellow.

Add the below name space and assembly

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

Syntax

public override SelectionMode SelectionMode { get; set; }

The following example demonstrates initializing a CheckedListBox control by setting the SelectionMode to allow one item in the list to be selected.To run the example, paste the following code in a form containing a CheckedListBox named CheckedListBox1 and call the InitializeCheckListBox method from the form’s constructor or Load method.


// This method initializes CheckedListBox1 with a list of all
// the controls on the form. It sets the selection mode
// to single selection and allows selection with a single click.
// It adds itself to the list before adding itself to the form.

internal System.Windows.Forms.CheckedListBox CheckedListBox1;

private void InitializeCheckedListBox()
{
this.CheckedListBox1 = new CheckedListBox();
this.CheckedListBox1.Location = new System.Drawing.Point(40, 90);
this.CheckedListBox1.CheckOnClick = true;
this.CheckedListBox1.Name = "CheckedListBox1";
this.CheckedListBox1.Size = new System.Drawing.Size(120, 94);
this.CheckedListBox1.TabIndex = 1;
this.CheckedListBox1.SelectionMode = SelectionMode.One;
this.CheckedListBox1.ThreeDCheckBoxes = true;

foreach ( Control aControl in this.Controls )
{
this.CheckedListBox1.Items.Add(aControl, false);
}

this.CheckedListBox1.DisplayMember = "Name";
this.CheckedListBox1.Items.Add(CheckedListBox1);
this.Controls.Add(this.CheckedListBox1);
}

How to display image and data in Repeater Control in asp.net & c sharp?

Example of Repeater Control in asp.net.

I have simple solution is bellow.

Displaying image in repeater control try following:


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"
SelectCommand="SELECT * FROM [country]"></asp:SqlDataSource>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<asp:HiddenField Value='<%# Eval("id") %>' ID="HiddenField1" runat="server" />
<asp:Image ID="Image1" runat="server" />
</ItemTemplate>
</asp:Repeater>

And add bellow code into aspx.cs page.


protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
HiddenField h_field =  e.Item.FindControl("HiddenField1") as HiddenField;
if (h_field != null)
{
string val_item = h_field.Value;
Image img = e.Item.FindControl("Image1") as Image;
img.ImageUrl = "~/image" + val_item + ".jpg";
}

}