|
Make the "print" button a submit, when you click on it you submit form to page that stores this data in database, and then you redirect to a page which will re-render all this informaiton in gridview and call over JavaScript page print command which is called this way: window.print()
Maybe someone else has better suggestion, you could submit data over "AJAX", but, it's same thing, anyhow he need to submit this data, only if you would save it over ajax you would save some time re-rendering gridview.
|
|
|
|
|
Could you not find the ASP.NET forum ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi guys ....
I've been writ a simple program using sockets to send data from client to server
here is my program
server code
<pre>
public class SocketListener
{
public static string data = null;
public static void StartListening()
{
byte[] bytes = new Byte[1024];
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000);
Socket listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
try
{
listener.Bind(localEndPoint);
listener.Listen(10);
while (true)
{
Console.WriteLine("Waiting for a connection...");
Socket handler = listener.Accept();
data = null;
while (true)
{
bytes = new byte[1024];
int bytesRec = handler.Receive(bytes);
data += Encoding.ASCII.GetString(bytes, 0, bytesRec);
if (data.IndexOf("< My 1st socket prog >") > -1)
{
break;
}
}
Console.WriteLine("Text received : {0}", data);
byte[] msg = Encoding.ASCII.GetBytes(data);
handler.Send(msg);
handler.Shutdown(SocketShutdown.Both);
handler.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
Console.WriteLine("\nPress ENTER to continue...");
Console.Read();
}
public static int Main(String[] args)
{
StartListening();
return 0;
}
}
</pre>
and client code
<pre>using System;
public class SocketClient
{
public static void StartClient() {
byte[] bytes = new byte[1024];
try {
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress,11000);
Socket sender = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
try {
sender.Connect(remoteEP);
Console.WriteLine("Socket connected to {0}",
sender.RemoteEndPoint.ToString());
byte[] msg = Encoding.ASCII.GetBytes("This is a test< My 1st socket prog >");
int bytesSent = sender.Send(msg);
int bytesRec = sender.Receive(bytes);
Console.WriteLine("Echoed test = {0}",
Encoding.ASCII.GetString(bytes,0,bytesRec));
sender.Shutdown(SocketShutdown.Both);
sender.Close();
} catch (ArgumentNullException ane) {
Console.WriteLine("ArgumentNullException : {0}",ane.ToString());
} catch (SocketException se) {
Console.WriteLine("SocketException : {0}",se.ToString());
} catch (Exception e) {
Console.WriteLine("Unexpected exception : {0}", e.ToString());
}
} catch (Exception e) {
Console.WriteLine( e.ToString());
}
}
public static int Main(String[] args)
{
StartClient();
return 0;
}
}</pre>
now I want to let 1st client "producer" generates random message and sends it to the server, then server checks the buffer, if there is enough space to store it, then it stores it, otherwise it neglects the message
and 2nd client "consumer" will be connected to the server and asks the server for data, the server in turn will check the buffer. If the buffer is empty then the consumer will wait
that's all and thank u
|
|
|
|
|
My application is having two listboxes.
first listbox is getting values from database
double click on first listbox value will remove from first listbox and add to second listbox.i completed this.
but my problem is double click on second listbox value should remove from second listbox and add to first list box and i already mentioned that first listbox is getting value from database.
|
|
|
|
|
Well, isn't it the same thing, but in the other direction ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
private void firstlistbox_DoubleClick(object sender, EventArgs e)
{
if (firstlistbox.Items.Count > 0 && firstlistbox.SelectedItems.Count > 0)
{
secondlistbox.Items.Add(lst_ApplicantGroups.Text);
dtCompanyForm.Rows.RemoveAt(firstlistbox.SelectedIndex);
firstlistbox.DataSource = dtCompanyForm;
//lst_ApplicantGroups.Items.Remove(lst_ApplicantGroups.Text);
}
}
//Above code is working fine
//but secondlistbox_doubleclick is not working.
//can anyone help me
private void secondlistbox_DoubleClick(object sender, EventArgs e)
{
if (secondlistbox.Items.Count > 0 && secondlistbox.SelectedItems.Count > 0)
{
string currentItemText = secondlistbox.SelectedItem.ToString();
int currentItemIndex = secondlistbox.SelectedIndex;
dtCompanyForm.Rows.Add(currentItemText);
secondlistbox.Items.RemoveAt(lstSelected.Items.IndexOf(lstSelected.SelectedItem));
firstlistbox.DataSource = dtCompanyForm;
}
|
|
|
|
|
What does 'does not work' mean ? What did you find was happening when you use the debugger ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
What is that "debugger" think you are talking about?
|
|
|
|
|
On MouseDoubleClick event of second listbox, add clicked item to the datasource of the first listbox.
|
|
|
|
|
private void firstlistbox_DoubleClick(object sender, EventArgs e)
{
if (firstlistbox.Items.Count > 0 && firstlistbox.SelectedItems.Count > 0)
{
secondlistbox.Items.Add(lst_ApplicantGroups.Text);
dtCompanyForm.Rows.RemoveAt(firstlistbox.SelectedIndex);
firstlistbox.DataSource = dtCompanyForm;
//lst_ApplicantGroups.Items.Remove(lst_ApplicantGroups.Text);
}
}
//Above code is working fine
//but secondlistbox_doubleclick is not working.
//can anyone help me
private void secondlistbox_DoubleClick(object sender, EventArgs e)
{
if (secondlistbox.Items.Count > 0 && secondlistbox.SelectedItems.Count > 0)
{
string currentItemText = secondlistbox.SelectedItem.ToString();
int currentItemIndex = secondlistbox.SelectedIndex;
dtCompanyForm.Rows.Add(currentItemText);
secondlistbox.Items.RemoveAt(lstSelected.Items.IndexOf(lstSelected.SelectedItem));
firstlistbox.DataSource = dtCompanyForm;
}
|
|
|
|
|
Same code works fine for me. Check that the event is fired and code within if block is getting executed on double click.
|
|
|
|
|
"Input string was not in a correct format.Couldn't store <we> in ID Column. Expected type is Int64." error is coming in dtCompanyForm.Rows.Add(currentItemText); line
|
|
|
|
|
It is clear enough. You are trying to add string value to integer column.
|
|
|
|
|
Hi,
ya i have done.
in first listbox double click-->i created one more datatable for second list box and i added removed row from first listbox to that datatable and i binded that datatable to second listbox.
in second listbox double click event just i did in reverse.
anyway iam thankful to u r help
|
|
|
|
|
|
Ok
i will do like that.
thank you
|
|
|
|
|
try this:
public void MoveItems(ListControl lbName1, ListControl lbName2)
{
for (int i = 0; i < lbName1.Items.Count; i++)
{
if (lbName1.Items[i].Selected == true)
{
ListItem li = new ListItem();
li.Text = lbName1.SelectedItem.Text;
li.Value = lbName1.SelectedItem.Value;
lbName2.Items.Add(li);
lbName1.Items.Remove(li);
i--;
}
}
}
protected void firstlistbox_SelectedIndexChanged(object sender, EventArgs e)
{
MoveItems(firstlistbox, secondlistbox);
}
protected void secondlistbox_SelectedIndexChanged(object sender, EventArgs e)
{
MoveItems(secondlistbox, firstlistbox);
}
|
|
|
|
|
Hello Experts!!
i got above error in following code--->
mysdset = new DataSet();
DataColumn mycolumn = new DataColumn("Picture");
mycolumn.DataType = typeof(System.Byte[]);
mysdset.Tables[0].Columns.Add(mycolumn);
mysdset.Tables["tblImgData"].Rows[0]["Picture"] = GetImageData(s);
where string s = dr["Picture"].ToString();
I am fetching image from sql and displaying into crystal report.
|
|
|
|
|
Isn't the error message telling anything to you?
"Cannot find table 0"
Check out if mysdset is having any tables.
|
|
|
|
|
It shows table rows count 2.....
|
|
|
|
|
This just makes me want to cry. It tells me you don't know how to use a debugger, you don't know how to read and understand a simple error message, you can't use google, and yet you're trying to read images from a database. How is this possible ?
Your dataset is empty.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
instead of writing such lines please suggest me link for same or give answer to question,that helps me more.....
|
|
|
|
|
If you don't have the common sense to work out what to do based on having been told what is wrong, I'm not sure what else to say. Your dataset is empty. What do YOU think you should do ( apart from writing code that is more robust ) ? How about fixing your SQL ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
First add a DataTable to your dataset.
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I assume his dataset is coming from a database, what he needs to do, is fix his SQL
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|