|
Do you have any experience using the webbrowser control in .NET?
I am having problems trying to handle click events in .NET
on HTML elements added programmatincally.
I am creating the HTML doc at runtime from data in a database
and I need to creat links that I can handle events for in .NET
so I can do things on the click event.
But I can create a element using Document.CreateElement("a")
and assign click event handler like this
anchor = _WebBrowser.Document.CreateElement("a");
anchor.InnerText = "Add Comment";
anchor.Id = "lnkAddComment";
anchor.SetAttribute("href", "#");
anchor.Click += new HtmlElementEventHandler(lnkAddComment_Click);
But in the event handler when you interrogate the sender object it gives
a generic "HtmlElement" as the source control and not the actual name
of the link that the click was initiated by.
Any ideas how I can handle events for programmatically created links??
rotsey
|
|
|
|
|
can i convert Timespan datatype to int.
if yes please show me example
regards
|
|
|
|
|
It depends on how you want the timespan to be represented as an integer. Many of its properties return an int already.
Dave
|
|
|
|
|
what do u want to do with the int?
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
i think u just use Ticks property of time that timespan but it returns 64 bits integer (long).
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks);
long ticks = ts.Ticks;
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
I have an aspx page to serve images. Basically it reads image from file using FileStream, creates a Bitmap using Image.FromStream and writes the bitmap to the output using bitmap.Save(Response.OutputStream). The image files are small in size but this page will get a lot of hits so I'm anxious about performance hit. Is there a way to read an image using streams (or any other better way) to the client without using memory like Response.TransmitMemory()?
|
|
|
|
|
No.
Everything you do requires memory. The CPU performs operations on stored memory, (usually in registers), not from disk. Without some kind of hardware gizmo you cannot do things without moving the data through memory.
Just manage your memory carefully. Ensure that once the image has been sent to the client, it is removed from local memory.
Simon
|
|
|
|
|
Why are you decoding the file into a Bitmap object? Do you change the image in any way before sending it as response?
Otherwise just use Response.WriteFile .
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all
I'm having a problem with delegate. In my project I have 2 forms, form1 and form2. From form1 I have a button there just for opening form2. And from form2 I have a text box there to enter an Int value. After getting a value from the text box I want to send it back to form1 and appear in a text box on form1.
I do this with a delegate but I don't know if my way is the way you use to solve this problem or not.
Here is my code:
Form1
<code>
public delegate void TestDelegate(int i);
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 frmOpen = new Form2();
frmOpen.ShowDialog();
}
public void GetValueA(int i)
{
textBox1.Text = i.ToString();
}
}
</code>
Form2
<code>
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int b;
b = Convert.ToInt32(textBox1.Text);
Form1 frm1=new Form1();
TestDelegate td = new TestDelegate(frm1.GetValueA);
td(b);
Close();
}
}
</code>
|
|
|
|
|
The way I do this is to create a public event and delegate in Form2. After I create the new instance of Form2 but before showing it, I subscribe to the event.
Dave
|
|
|
|
|
Hi.
Try to create this in Form2:
public int GetNumericValue()
{
this.ShowDialog();
int iOut = 0;
int.TryParse(textBox1.Text, out iOut);
return iOut;
}
and change the button_click event to
private void button1_Click(object sender, EventArgs e)
{
Form2 frmOpen = new Form2();
textBox1.Text = frmOpen.GetNumericValue().ToString();
}
This is similar to the good old InputBox in VB.
Kjetil
|
|
|
|
|
This is my Login Page URL
http://localhost:3271/NocSystem/LoginPage.aspx
This is my Admin(Home)Page URL
http://localhost:3271/NocSystem/AdminPage.aspx
If i copy & paste the home pages URL with another Browser it is loading.I want to avoid that.Because if one of user got that URL he can easily access to my web base system through my web server.I'm developing this system to run @ my office's web server.
If one of user copy and paste that URL i wanna redirect to my Login Page.How can i do that...?
Its urgent..!!!
CheeN
|
|
|
|
|
sacr83 wrote: Its urgent..!!!
No, not really, I have all the time in the world. It's only urgent for you, and frankly no-one cares about that.
Now, if you weren't so bloody impatient and double posting, you would have realized, you are posting this in the incorrect forum. This should go to ASP.NET.
|
|
|
|
|
This is my Login Page URL
http://localhost:3271/NocSystem/LoginPage.aspx
This is my Admin(Home)Page URL
http://localhost:3271/NocSystem/AdminPage.aspx
If i copy & paste the home pages URL with another Browser it is loading.I want to avoid that.Because if one of user got that URL he can easily access to my web base system through my web server.I'm developing this system to run @ my office's web server.
Its urgent..!!!
CheeN
|
|
|
|
|
use asp.et configuration tool in website menu if you are using Visual Studio i think it's possible by manipulating web.config, use some Google search
I Wish the Life Had CTRL-Z
Wizards First Rule : People are fool,they believe what they want to believe or what they afraid to believe
www.subaitech.blogspot.com
|
|
|
|
|
mates,
does anyone here experience error on excel on c#?
i have an application which will generate an excel file using c# code. the problem is i uninstall office 2000 and install office 2007.
when i run my application. it will prompt unable to find excel.
please help me.
thanks.
C# Coudou
C# Developer
******************************
The best things in life are free
******************************
|
|
|
|
|
You need to change the references to the office dlls.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
ahh.. yeah. i forgot that one. now, fixed already.
thanks mate.
C# Coudou
******************************
The best things in life are free
******************************
|
|
|
|
|
Easily done, thats why I knew the answer
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi,
I had to move a MSAccess Database to a new location.
In VS2005: Is it possible to change the path only without recreating all queries and tableconectors etc.?
Thanks!
Ariadne
|
|
|
|
|
It should be, your connection string defines the path to the MDB, all the queries etc are running on the connection.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ariadne wrote: I had to move a MSAccess Database to a new locati
so, you have just move the MDB file, then you dont need to change in any query or table etc. just change the DBpath in connection string .
Thanks
|
|
|
|
|
Abhijit Jana wrote: just change the DBpath in connection string
is there a usual way in VS2005? I tried to change all occurrences of the old DBPath into the new one. But VS allways looks at the old path.
Ariadne
|
|
|
|
|
one has to compile the project! Then the DB-Path is changed...
And if you want to use the new DB-Path in your xsd DataSet (eg. Data Preview) you have to restart VS.
Thanks
Ariadne
modified on Thursday, June 26, 2008 5:57 AM
|
|
|
|
|
protected void bn_delete_Click(object sender, EventArgs e)
{
bool atLeastOneRowDeleted = false;
// Iterate through the Products.Rows property
foreach (GridViewRow row in GridView1.Rows)
{
// Access the CheckBox
CheckBox cb = (CheckBox)row.FindControl("CheckBox1");
if (cb != null && cb.Checked)
{
// Delete row! (Well, not really...)
atLeastOneRowDeleted = true;
// First, get the StaffID for the selected row
int StaffID = Convert.ToInt32(StaffID.DataKeys[row.RowIndex].Value);
//"Delete" the row
DeleteResults.Text += string.Format
("This would have deleted StaffID {0}<br />", GridView1);
}
}
|
|
|
|