|
i m using javascript function to sto back button.
function logout()
{
Backlen=history.length;
alert('history len ' + Backlen);
history.go(-Backlen);
}
and in code file
FormsAuthentication.SignOut();
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
Session.Abandon();
Response.Redirect("~/frm_Default.aspx");
back button is disable now but forward button still working its opening the pages .. i dont want to disable back and forward for all the pages i only want at the time of logout.. thnx in advance
|
|
|
|
|
Not sure why people are so much worried on Back/Forward buttons. Anyway, check this[^] thread.
|
|
|
|
|
forward button still not disable it does not open logout page but it opens next to that on click of forward button
|
|
|
|
|
Hi guy,
I am Creating (ActiveX control or win-form libarary) in C# using ASP.Net.
Everything has been done successfully but when I run the web-form
on the browser screen show me prompt dialog "Security-warning" Messages.
with Run or Don't Run two buttons
I want to can’t Show this Dialog, Anyone help me.
web-form expose ActiveX Control Codes.
<object id="myControl1" name="myControl1"
="" classid="ActiveXDotNet.dll#ActiveXDotNet.myControl" width="288" height="72">;
;
|
|
|
|
|
ActiveX controls are external objects and embeeded with browser. It's execution is solely dependant on the browser's security settings. The security warning message can be removed by changing the browser settings but that can be dengerous as far as the security threats are concerned. It can be accepted if the application will run with in the network.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
Hi,
Thanks for help, but what's alternative way.
We have needed to Client-side ActiveX control without asking Security message in browser.
|
|
|
|
|
Dear all
i want to a label on image control
this label will display a dynamic text about the image
but i should be a image control becose the imageur will be dynamic and the image will change in a timer
so i want to display the label over the image control to display a text about the image
thanks for help
MD_NADA
|
|
|
|
|
I have a tree view in my page. I want to show the name of of selected node
along with it's parent node. I am using the folleing event. I want my text
of lable like follwing when I click child node aaa
AA--> aaa.
Where AA is parent node's text and aaa is child node's text. I don't want
to use Sitemappath.
|
|
|
|
|
when you clicked the Node Get Parent Nodes of Selected Node
and Show it on label.
Example.
TreeNode ParentNode= new TreeNode();
ParentNode=this.treeviewCtrl.SelectedNode.Parent
string strFullNode=ParentNode.Text + ">>"+ this.treeviewCtrl.SelectedNode.Text
|
|
|
|
|
In my site i have a div to represent a blog post like below
<div class="post">
<div class="header">
<h3>Header</h3>
<div class="date">May 18, 2009</div>
</div>
<div class="content">
Some Content
</div>
</div>
Basically, what i'm wanting to do is select the 10 recent posts from a database and build the page with these posts using the div tags above. I can already do the easy things like setting the header, date, and content.
Thanks,
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
So, what is your question?
|
|
|
|
|
what i can't figure out is how to create dynamically create div's for each post (as opposed to hardcoding them in the aspx file).
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
I think i figured it out. The solution i found is something like this:
(i know this won't generate the markup in the original post, this is in a seperate test project)
ContentPlaceHolder leftContent = (ContentPlaceHolder)Master.FindControl("leftContent");
HtmlGenericControl div = new HtmlGenericControl("div");
div.Attributes.Add("class", "post");
HtmlGenericControl h2 = new HtmlGenericControl("h2");
h2.InnerText = "My Header";
HtmlGenericControl p = new HtmlGenericControl("p");
p.InnerText = "This is some content.";
div.Controls.Add(h2);
div.Controls.Add(p);
leftContent.Controls.Add(div);
which will then generate this:
<div class="post"><h2>My Header</h2><p>This is some content.</p></div>
Is there a better way to achieve what i'm trying to do? I feel like i'm going against the grain here.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Use asp.net repeater control.
<asp:Repeater id="rPOSTS" runat="server">
<ItemTemplate>
</ItemTemplate>
<asp:Repeater> On ItemTemplate you will put the code you want to repeat X times.
So, in code behind you will do something like this:
rPOSTS.DataSouce = YOUR_DB_DATA;
rPOSTS.DataBind();
See more about repeater control in Google[^].
|
|
|
|
|
Sweet! That was easy enough For future readers this is the result that paulo helped me come up with
in the aspx file:
<asp:Repeater runat="server" ID="postRepeater">
<HeaderTemplate>
<div class="post">
</HeaderTemplate>
<ItemTemplate>
<h2>
<%#DataBinder.Eval(Container.DataItem, "Header")%></h2>
<p>
<%#DataBinder.Eval(Container.DataItem, "Content")%></p>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
and in the code behind:
System.Data.DataTable dt = new System.Data.DataTable("Posts");
dt.Columns.Add(new System.Data.DataColumn("Header"));
dt.Columns.Add(new System.Data.DataColumn("Content"));
System.Data.DataRow row = dt.NewRow();
row[0] = "Header 1";
row[1] = "Content 1";
dt.Rows.Add(row);
postRepeater.DataSource = dt;
postRepeater.DataBind();
Thanks again
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
If i have a string that contains a comma how do i write that to a csv file without it thinking they are two different words?
|
|
|
|
|
use a text qualifier. 'joe, blow', 'money, its good', 'do you see a pattern'
I didn't get any requirements for the signature
|
|
|
|
|
It doesn't work. It thinks its two different values and places them in two different cells
|
|
|
|
|
If you want to write something for Excel, do something like this...
System.Data.DataTable DT = TankBookWeb.sqlDataObjects.GetInquiryDetailExcel();
if (DT != null)
{
//clear anything in io buffer
Response.Clear();
//set to excel for to save file.
// Response.AddHeader("Content-Disposition", "attachment;filename=TankBookExport.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
//write columns
string tab = "";
foreach (DataColumn dc in DT.Columns)
{
Response.Write(tab + dc.ColumnName);
tab = "\t";
}
Response.Write("\n");
//write rows
int i;
foreach (DataRow dr in DT.Rows)
{
tab = "";
for (i = 0; i < DT.Columns.Count; i++)
{
Response.Write(tab + dr[i].ToString());
tab = "\t";
}
Response.Write("\n");
}
Response.End();
}
As for the csv, you need to tell what program you are using to open the file that their is text qualifier.
I didn't get any requirements for the signature
|
|
|
|
|
I’ve got a simple page that should display the string “OK” when the user clicks the button. It works fine untill I put a RequiredFieldValidator on the page. Now it seems like there is an implicit conditional in the source code that prevents the “OK” from being displayed unless the text box has text in it. I put no such conditional in the code; why is it behaving like this?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="pageIsValidTest.aspx.vb" Inherits="pageIsValidTest" %>
<!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>
Textbox:
<asp:TextBox ID="TextBox" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox"
ErrorMessage="enter text"></asp:RequiredFieldValidator><br />
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
Label:
<asp:Label ID="Label" runat="server"></asp:Label></div>
</form>
</body>
</html>
Partial Class pageIsValidTest
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label.Text = "OK"
End Sub
End Class
|
|
|
|
|
That is because the RequiredFieldValidator has the ControlToValidate set to the text box. It is working as it should, if no text is in the ControlToValidate the RequiredFieldValidator will prevent your server side code from running.
|
|
|
|
|
Thanks! Didn’t mention that in the book I’m using so I was confused.
But then what is the point of Page.IsValid? If the server side code will only run if all Validators are true then it seems that it would be impossible to get a false Page.IsValid…
What if I want server side code to do something if the form isn't valid, is there a way to override this behavior?
|
|
|
|
|
You can change the "Causesvalidation" of your button to "False" , so it will work without fire the Validators.
i hope it help you.
|
|
|
|
|
Thanks you for the response but not quite what I am looking for. I’m looking for a way to run the source code and within that source code programmatically determine if the page is valid (meaning a validaters = true) and do something it is and something else if its not.
|
|
|
|
|
ok. But you must be more explicit,ex: what are you doing in the page before you do that request?
|
|
|
|