|
Yes. Add Page_PreRender method to the master page. This is the later in the page's life cycle than page_load. Move the databind() call to that method, see if you get the current user.
I didn't get any requirements for the signature
|
|
|
|
|
Hi
Thank you ToddHileHoffer,
I did exactly that, but the problem remains. on the landing page i get an old map.
here is the current masterpage code
Protected Sub lkbLogout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lkbLogout.Click
ClearUser()
CheckUser()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
CheckUser()
End Sub
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
xdsSiteMap.DataFile = ""
xdsSiteMap.Data = CurrentMap.OuterXml
MainMenu.DataBind()
End Sub Please reply, i cant figure this out...
|
|
|
|
|
I'm sorry your page isn't working.
Where are you setting the datasource for the MainMenu? Why don't you call xdsSiteMap.Databind() instead of MainMenu.Databind()?
Can you debug the page and set a break point on your menu or site map and verify that the data source in the PreRender method does not match the data when the page is rendered?
Another question is why are you calling CheckUser() twice? In the code above you would call CheckUser in the pageload and then agin on lkbLogout.Click(). Maybe you want to use if(!postback) in your pageload.
I didn't get any requirements for the signature
|
|
|
|
|
hi
thanks for your reply
in the end, my assumption was correct, the xds has an attribute called enavlecaching, i turned that off and all is good.
thank you for your time and interest,
it was a pleasure discussing this with you.
|
|
|
|
|
Thank you. I've been fussing with my code, on and off, for the last few days trying to figure out why I couldn't get my string output of XML data to bind to my ListView object in .Net 3.5. I found the "onPreRender" statement in another article but a separate test datalist object bound fine in the "OnLoad" event. Turning the caching off was exactly what I needed- thanks.
|
|
|
|
|
glad to be of help
|
|
|
|
|
Hi
try EnableCaching="false" on XmlDataSource control
<asp:xmldatasource id="xdsSiteMap" runat="server" datafile="~\App_Data\SiteMap.xml" xpath="siteMap/siteMapNode">
|
|
|
|
|
i have created 1 website at my home.i want to host it..wat shud i need to do..can any1 tell me in detail? i want everything in full detail
|
|
|
|
|
Do you want to host it at home? I would use a hosting company, it costs about $100 - $500 per year to have an asp.net / sql server site hosted for you.
I didn't get any requirements for the signature
|
|
|
|
|
i also want to use a hosting company...so for that wat shud i do?? will i need to make any changes in my code or just approach any company with my code and database??
|
|
|
|
|
I used http://www.appliedi.net/aspnet-3.5-hosting/[^] and it was pretty easy.
They give you a virtual directory with FTP access to it. You can use any ftp program to copy up your website.
They will give a SQL Server database. You will get owner rights to your own database. You connect to it via the IP address right from Management studio on your desktop computer.
Good luck.
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
After inserting the data I am clearing the textbox and dropdownlist. But when I press the refresh button in the browser once again the data is inserted. This happens not only for Insert but also for all are the event that happens last once again happens when browser refreshed. We are not using Ajax.
Thanks,
Ashok
|
|
|
|
|
try by setting the enableviewstate property of the controls to false
|
|
|
|
|
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?
|
|
|
|