Displaying Paging In ASP.Net
Posted in .Net, ASP.Net, C#, Uncategorized on April 22, 2008 | No Comments »
Posted in .Net, ASP.Net, C#, Uncategorized on April 22, 2008 | No Comments »
Posted in .Net, ASP.Net, C#, Uncategorized on December 5, 2007 | No Comments »
Sometimes, there is a need to post a form from one page to another without any UI element. This is how to do it programmatically:
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(“FormElementName=” + formElementValue);
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(http://somesite/somepage);
myRequest.Method = “POST”;
myRequest.ContentType = “application/x-www-form-urlencoded”;
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
Posted in .Net, ASP.Net, C#, HTML, JavaScript, Uncategorized on October 25, 2007 | No Comments »
<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Default.aspx.cs” Inherits=”_Default” %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head runat=”server”>
<title>Untitled Page</title>
</head>
<body>
<form id=”form1″ runat=”server”>
<div>
<asp:ListBox ID=”LBSource” SelectionMode=”Multiple” runat=”server”>
<asp:ListItem Text=”Item1″ Value=”vItem1″></asp:ListItem>
<asp:ListItem Text=”Item2″ Value=”vItem2″></asp:ListItem>
<asp:ListItem Text=”Item3″ Value=”vItem3″></asp:ListItem>
<asp:ListItem Text=”Item4″ Value=”vItem4″></asp:ListItem>
<asp:ListItem Text=”Item5″ Value=”vItem5″></asp:ListItem>
</asp:ListBox>
<input type=”button” value=”Add” onclick=”moveItems(’<%= LBSource.ClientID %>‘, ‘<%= LBDestination.ClientID %>‘)” />
<input type=”button” value=”Remove” onclick=”moveItems(’<%= LBDestination.ClientID %>‘, ‘<%= LBSource.ClientID %>‘)” />
<asp:ListBox [...]