|
Hello,
I have been reading about setting dynamic page titles in ASP.NET 2.0, in order to modify the "catalog.aspx" page of my web application. Most of the articles on this subject, however, seem to be describing somewhat complicated solutions for creating dynamic site maps, whereas I would just like to set the title of my catalog.aspx page to the name of the current category or product in my catalog.
Although I can see how to set the title property in code like so:
Sub Page_Load()<br />
Page.Header.Title = "The current time is: " & DateTime.Now.ToString()<br />
End Sub
...I can't figure out how to dump the contents of a <%# Container.Name %> -type container into this statement.
I am using a 3rd-party shopping cart package (DotNetCart), that displays categories and products on the http://www.mywebsite.com/catalog.aspx page in typical catalog fashion:
http://www.mywebsite.com/catalog.aspx?CategoryID=200 (The category named "Handbags")
http://www.mywebsite.com/catalog.aspx?CategoryID=200&ItemID=13 (The category named "Handbags", and the item "Canvas Handbag")
In the above examples, I'd like to have the page title change to "My Website: Handbags" and "My Website: Canvas Handbag" respectively.
The third-party vendor's catalog control looks sort of like this (extra tags and declarative controls omitted):
<dotnetCART:DisplayCatalog><br />
<CategoryTemplate><br />
<%#Container.Image%><br />
<%# Container.Name %><br />
</CategoryTemplate><br />
<ItemDetailsTemplate><br />
<%#Container.Name%><br />
<%#Container.ItemID%><br />
<%#Container.Price%><br />
</ItemDetailsTemplate><br />
</dotnetCART:DisplayCatalog>
How would I go about displaying the catalog control's Category and ItemDetails' Names in my page title attribute? Thanks for any advice.
|
|
|
|
|
I'm not familiar with dotnetcart, but if it supports databinding, then you should be able to handle one of the events, like ItemDataBound or something like that, and set the page title in the code behind.
- S
50 cups of coffee and you know it's on!
A post a day, keeps the white coats away!
|
|
|
|
|
Hi,
I wanted to use forms authentication and for this i have to specify the paths for the folder that the
user is allowed to navigate to based on the roles he is in.
But the problem is i have 100 roles in my database. So its tedious to write authorization using the code
<location path="AdminModerator">
<system.web>
<authorization>
<allow roles="Administrator,Moderator">
<deny users="*">
Is there any other method to do this.
Thanks...
bitsbuilt
|
|
|
|
|
Hi All,
I want to set the ctrlKey value to true/false through code in javascript.
While trying to do this as shown, I'm getting an error like 'htmlfile: Member not found'.
But the ctrlKey property is read-write (as per msdn)
function f1()
{
event.ctrlKey = true;
}
Can any one help me please. *** Urgent ***
|
|
|
|
|
How is event passed, and how is your function called? It needs to be placed as the first argument in your function declaration to be referenced within the function.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
how can i pass product_id from database to query stirng .
in mainpage i m populating detailviewcontrol with all products from database
columns are
product_id,name,etc
i hv a button "detail about product"
and against button clicking following statment
Response.Redirect("detail.aspx?p_id=1)
i want to use product_id database field instead of constant '1' so that
in detailpage selected product detail can be displayed (not of product_id=1)
plz help me how to pass product_id in query string........ ![Frown | :(](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_frown.gif)
|
|
|
|
|
i m trying to get product_id value from detailview control and passing it as query string using following statement
Response.Redirect("detail.aspx?cat_id=" + DetailsView1.Rows(1).Cells(0).Text)
but getting error like
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
plz help me how to fix it or another way to pass product_id as querystring
|
|
|
|
|
It looks like you are showing the code from one page and the error page from another page.
If the cell in the DetailsView doesn't contains the representation of a number, and if you try to parse the query string without verifying it, you would get that error message when the details page loads.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
I am not able to pass a form field value to a storedprocedure in detailsview. I am getting an error message. I couldn't figure out what is causing the problem. If you help me to solve it, I would really appreciate it.
The detailsview code is shown below also the stored procedure. The error message is:
"Procedure or function 'StoredProcedure1' expects parameter '@GetActivityName', which was not supplied. "
Thank you.
<br />
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" <br />
BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" <br />
CellPadding="3" CellSpacing="1" <br />
DataSourceID="SqlDataSource1" DefaultMode="Insert" GridLines="None" <br />
Height="50px" Width="125px"><br />
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" /><br />
<RowStyle BackColor="#DEDFDE" ForeColor="Black" /><br />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" /><br />
<Fields><br />
<asp:BoundField DataField="ActivityName" HeaderText="ActivityName" <br />
SortExpression="ActivityName" /><br />
<asp:CommandField ShowInsertButton="True" /><br />
</Fields><br />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /><br />
<EditRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" /><br />
</asp:DetailsView><br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HolidayDBConnectionString %>" <br />
InsertCommand='StoredProcedure1' InsertCommandType="StoredProcedure"><br />
<InsertParameters><br />
<asp:Parameter Name ="ActivityName"/> <br />
<asp:Parameter Size ="50" Direction ="ReturnValue" Name="GetActivityName" /> <br />
<br />
</InsertParameters><br />
</asp:SqlDataSource><br />
STORED PROCEDURE 1
<br />
ALTER PROCEDURE dbo.StoredProcedure1 <br />
(<br />
@GetActivityName nvarchar(50)<br />
) <br />
AS<br />
<br />
BEGIN<br />
<br />
INSERT INTO activities VALUES (@GetActivityName)<br />
<br />
END<br />
<br />
RETURN<br />
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
in my project at one place sthing like this is been writen
SetHistoryHandler(
{
ScreenId: SCREEN_CONTACTS,
Entity: PART_NEW_GROUP, Contacts: contacts
}
);
i coule not understand what does this ':' doing when passing arguments for ex. one argument is Entity: PART_NEW_GROUP ,it contain ':' after Entity
Raghvendra
|
|
|
|
|
That is a Javascript object literal. It is similar to an array list, except the members are enclosed in curly brackets and each member is defined explicitly with a name, followed by a colon, and each member is separated with a comma, not a semi-colon. Once an object literal has been defined, then each member can be accessed with Object literal variable name.Member name
For example, if you do this:
var fruit = {apples: 1,
bananas: 2,
oranges: 3,
grapes: 20
};
This creates an object with the members apples, bananas, oranges and grapes with values of 1, 2, 3 and 20 respectively.
The members can be accessed like so:
fruit.apples;
fruit.bananas;
fruit.oranges;
fruit.grapes;
Object literals are especially useful in argument lists, as it means that the arguments don't have to all be present, or have a set order to be defined in.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
modified on Sunday, September 21, 2008 2:57 AM
|
|
|
|
|
Thanks,
now i cam corelate it in project
Raghvendra
|
|
|
|
|
i get it that
SetHistoryHandler(
{
ScreenId: SCREEN_CONTACTS,
Entity: PART_NEW_CONTACT
}
);
var fruit = {apples: 1,
bananas: 2,
oranges: 3,
grapes: 20
};
sounds bit differ
in my one
{
ScreenId: SCREEN_CONTACTS,
Entity: PART_NEW_CONTACT
}
does not sounds some thing like anonimeous structure means it does not have any name so we can refer some where else
i mean i could not get it fully when i do compare it, alone it make full sence to me
Raghvendra
|
|
|
|
|
SCREEN_CONTACTS and PART_NEW_CONTACT appear to be variables, so the values of ScreenId and Entity take the value of these variables.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|
|
|
hello evry body
i am beginner in asp.net(with c#) . Im going to get IP from users that see my site.
Thank you
|
|
|
|
|
try
String userIP = Context.Request.UserHostAddress;
Intelligence is almost useless for those who have nothing else!
Email: caiokf@gmail.com
|
|
|
|
|
I need to generate some controls dynamically.So i code as belows:
using System;
using System.Web;
...
namespace MyProject
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
TableRow row = new TableRow();
TableCell cell = new TableCell();
Button btn = new Button();
btn.ID = "btnCreated";
cell.Controls.Add(btn);
row.Cells.Add(cell);
this.Table1.Rows.Add(row);
btn.Click += btn_Click;
}
protected void btn_Click(object sender, EventArgs e)
{
this.TextBox1.Text = "test";
}
}
...
when i run it,the table(include the new button) can be show after i click the button1 .But when i click the new button(ID as btnCreated),it doesnt work.And the worse is the created table disappears after i click the new button.
How to solve it??
|
|
|
|
|
Dynamically added control have to be added each time the page is posted back
I think you must add them in the preinit event
Try that and see what happens
Alexei Rodriguez
|
|
|
|
|
thank you,I tried adding code in Preinit event,it really worked.
I still have some question,I need to add control by clicking the assigned button,but if i add this code in preinit event,it always add control whenever any button clicked.If i got 2 or more buttons on the page ,how to identify which button cause the adding event?
The second is,how to save the dynamically added control's property (for example:textbox) ,if i change the text of the textbox,after page posted,the dynamically added control re-builded,how can i get the changed text.
|
|
|
|
|
Hello all
I am displaying treeview in a dropdownlist using Ajax dropdownextendar control. But i am facing one problem.
When i click on "+" image in treeview for displaying subnodes then at that time page get post back and it again hide the treeview and when i click on dropdownlist then it shows me nodes and its subnodes.
As per the requirement when i click on "+" in treeview control image it should show me subnodes without postback.
Help Me
Thanks
Rahul
People Laugh on me Because i am Different but i Laugh on them
Because they all are same.
|
|
|
|
|
|
Hi,
I currently have a site and I do have an SSL key, but I am not forcing the main page to be run in SSL. However, this main page has a few options that anonymous users can use as well as a login/password text box using ASP.NET's built in login functionality.
Is it possible for me to have it so that, when the user enters data into the username/password and submits it, it goes through SSL for the postback here regardless of if they are logging into the site via HTTPS or HTTP? I am trying to avoid forcing the main page to be always run in SSL and I am assuming that if I don't do anything and the user logs in over HTTP, their username/password is sent around in clear text.
Thanks,
Steve
|
|
|
|
|
wpisteve wrote: username/password is sent around in clear text.
You could always just use a one-way secured crypto hash of the password. Why not just use SSL?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
How about a box for the user's username which is on the main HTTP page which then goes to a separate HTTPS page where the user then enters their password which is then encrypted. I've seen banks do this with Internet banking, where the user enters an ID or other insensitive piece of data then they are redirected to an encrypted page to enter the sensitive information like sort code and security number.
Regards,
--Perspx
"I've got my kids brainwashed: You don't use Google, and you don't use an iPod." - Steve Ballmer
"Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen an angry penguin charging at them in excess of 100mph." - Linus Torvalds
|
|
|
|