|
Redirect to the same page using Response.Redirect() once you have successfully enter the data. This will prevent the refreshing in performing a postback.
|
|
|
|
|
One easy way to handle this is to set a session variable the first time the page is posted. You can check for the presence of this on any refresh and if it already exists, prohibit posting of any information.
Ranjit Viswakumar
Professional Services Specialist
HostMySite.com[^]
|
|
|
|
|
<pre>
Protected Sub rdb1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdb1.CheckedChanged
If (rdb1.Checked = True) Then
rdb2.Checked = False
rd3.Checked = False
rd4.Checked = False
rd5.Checked = False
rd6.Checked = False
rd7.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rdb2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdb2.CheckedChanged
If (rdb2.Checked = True) Then
rdb1.Checked = False
rd3.Checked = False
rd4.Checked = False
rd5.Checked = False
rd6.Checked = False
rd7.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rd3_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rd3.CheckedChanged
If (rd3.Checked = True) Then
rdb1.Checked = False
rdb2.Checked = False
rd4.Checked = False
rd5.Checked = False
rd6.Checked = False
rd7.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rd4_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rd4.CheckedChanged
If (rd4.Checked = True) Then
rdb1.Checked = False
rdb2.Checked = False
rd3.Checked = False
rd5.Checked = False
rd6.Checked = False
rd7.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rd5_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rd5.CheckedChanged
If (rd5.Checked = True) Then
rdb1.Checked = False
rdb2.Checked = False
rd3.Checked = False
rd4.Checked = False
rd6.Checked = False
rd7.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rd6_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If (rd6.Checked = True) Then
rdb1.Checked = False
rdb2.Checked = False
rd3.Checked = False
rd4.Checked = False
rd5.Checked = False
rd7.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rd7_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rd7.CheckedChanged
If (rd7.Checked = True) Then
rdb1.Checked = False
rdb2.Checked = False
rd3.Checked = False
rd4.Checked = False
rd5.Checked = False
rd6.Checked = False
rd8.Checked = False
End If
End Sub
Protected Sub rd8_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If (rd8.Checked = True) Then
rdb1.Checked = False
rdb2.Checked = False
rd3.Checked = False
rd4.Checked = False
rd5.Checked = False
rd6.Checked = False
rd7.Checked = False
End If
End Sub
</pre>
Thanx,
KOUNDINYA
|
|
|
|
|
These lengthy coding is not necessary....You can find GroupName property of each radiobutton. Give the same groupname to all radiobuttons. and try
Balasubramanian K.
|
|
|
|
|
Good answer, but this is the ASP.NET forum.
However, I have a feeling you're right anyway as I think, looking at the code, that this is a winforms question!
|
|
|
|
|
The questioner asked that cannot be selected the only one radiobutton at a time. I thought that the person used this code as code behind for web form. Thats why I replied like this.
Balasubramanian K.
|
|
|
|
|
The whole point of a list of radio buttons is that only 1 item is selectable. If you use an asp:RadioButtonList it does all this for you.
Saying that, what exactly doesnt work in the code you've written?
|
|
|
|
|
thank u got the point... but i will try it..
Thanx,
KOUNDINYA
|
|
|
|
|
Hello,
I'm trying to display a picture from my db using linq.
protected void Button1_Click(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
test1 x2 = db.test1s.First(p => p.descriere.StartsWith(" Firma bazata pe intuitia cumparatorulu"));
byte[] img = (x2.img);
MemoryStream ms = new MemoryStream(img);
System.Drawing.Image Image1 = System.Drawing.Image.FromStream(ms);
MemoryStream stream = new MemoryStream;
Image1.Save(stream,ImageFormat.Jpeg);
Bitmap b = new Bitmap(Image1.Width, Image1.Height);
Graphics g = new Graphics.FromImage(b);
}
where test1 is a table with 3 fields- id-int/descriere char/img image.
my error: 'System.Drawing.Graphics.FromImage(System.Drawing.Image)' is a 'method' but is used like a 'type'.
Can someone tell me what why or tell me how to do it? Please dont tell me to search on goole..
i have read everything i could find on google and i cant figure it out.. i'm new in the field.
|
|
|
|
|
Hi,
the compiler error is saying anything. First Graphics.FromImage is a static method so you should rewrite it like this:
Graphics g = Graphics.FromImage(b);
Second if you try to run a method on an object, created in the same line you have to write it like this:
object a = (new B()).callMethodA();
Regards
Sebastian
|
|
|
|
|
protected void Button1_Click(object sender, EventArgs e)
{
DataClassesDataContext db = new DataClassesDataContext();
test1 x2 = db.test1s.First(p => p.descriere.StartsWith(" Firma bazata pe intuitia cumparatorulu"));
byte[] img = (x2.img);
MemoryStream ms = new MemoryStream(img);
System.Drawing.Image Image1 = System.Drawing.Image.FromStream(ms);
MemoryStream stream = new MemoryStream();
Image1.Save(stream,ImageFormat.Jpeg);
Bitmap b = new Bitmap(Image1.Width, Image1.Height);
Graphics g = Graphics.FromImage(b);
g.DrawImage(Image1, 0, 0);
}
the code works but it doesn't display anything. When i debugged i saw that the image is loaded correctly in image1 and in b. Any ideas?
|
|
|
|
|
Do you have a control to display the image? ImageBox or Image?
|
|
|
|
|
Yes, the control is Image1 - type System.Web.UI.WebControls.Image
|
|
|
|
|
The problem is that it is not that simple. The Image Control needs an URL to point to the image to display. What you need to do is to build a page which takes the image-identifier as parameter (within the query string) and puts out as response the image content. The Image Control points to this page. Sounds complicated but is really easy. Found a tutorial in the web:
http://www.sitepoint.com/article/generating-asp-net-images-fly/[^]
Hope this helps.
|
|
|
|
|
Hi,
I want to use a Frameset in .net webpage. This Framset is to create a Left Navigation menu. In the Frameset i want to have a Tree view control. I dont have idea about the Frameset. Can anybody pls help me on how to use a Frameset in .Net with Tree view control.
Tnx in advance.
With Regards,
Anand
|
|
|
|
|
Do not use a frame set!
Try a master page. There are countless examples of how to do this all over the interweb.
I didn't get any requirements for the signature
|
|
|
|
|
|
I have created 5 RadioButtons dynamically on 5 place holders
They are created on the click on another button i.e. not on the PageLoad event
I have added a handler for each of them like:
rad1.CheckedChanged += new EventHandler(rad_CheckedChanged);<br />
rad2.CheckedChanged += new EventHandler(rad_CheckedChanged);<br />
...
Same event handler for all
The controls render fine, but when I check them all the control disappear and the checkedchanged event is not fired.
I read somewhere that they need to be created on the pageload event. But the need to be created on an event after the pageload.
plz hlp.
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
|
I have created on crosstab report in crystal report and applying the css to that report,and showing report in webapplication which is developed in .net (ASP and c#.net). I am trying to export that report, it export but css is lost.
can we export the report along with css? if yes How?
|
|
|
|
|
Good Afternoon All
I have a Code that write a WebConfig everytime it loads.
public void UpdateConfig(string strKey, string strValue)
{
Configuration objConfig = WebConfigurationManager.OpenWebConfiguration("~");
AppSettingsSection objAppsettings = (AppSettingsSection)objConfig.GetSection("appSettings");
if (objAppsettings != null)
{
objAppsettings.Settings[strKey].Value = strValue;
objConfig.Save();
}
}
Its working,on the Developement side, and i have deployed my app to the Testing side and when i go to the page i get the Following Error that i cant google, it seems it has something to do with the Permission. so i get the Following Error
Parser Error Message: An error occurred loading a configuration file: Access to the path 'C:\inetpub\wwwroot\o!Booking\1vc6a6ca.tmp' is denied.
[No relevant source lines]
Source File: C:\inetpub\wwwroot\o!Booking\web.config Line: 0
Thanks
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
Good Afternoon
Thanks for your Help.
The Problem was the Permission for the ASP.NET Account that was never inherrited when i created a Virtual Directory. The Following thread helped me
http://bytes.com/groups/net-asp/634802-configuration-error-web-config-no-relevant-source-line
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswam@its.co.za
|
|
|
|
|
I am doing a project. Its 1 of the module is deigning of Forum same as the structure of Code project Forum. Can anyone suggest the database for it? Please...
|
|
|
|
|
Karthick_gc wrote: Can anyone suggest the database for it?
SQL Server?
|
|
|
|
|
Yes. I want the table structure for that?
|
|
|
|