|
something like this seems to be working now BUT it doesn't seem to pick up the Eval. I think Christian meant something like this:
<asp:linkbutton id="GoToArticle" onclick="Go_To_Article" runat="server" xmlns:asp="#unknown"><![CDATA[<%# Eval("ID") %>]]></asp:linkbutton>
Note: [xmlns:asp="#unknown">] is supposed to be [><%# Eval("ID") %>]. Don't know why it comes out messed up but there you go
Now this button works because it goes to the next page but it doesn't submit the query string however I know why and that's because I don't know how to extract the Eval("ID") from the button hehe. So the part i'm stuck on is this:
Response.Redirect("~/NewsArticle.aspx?ID=" + this.GoToArticle)
I know (well, I get the feeling) that the this.GoToArticle is supposed to be expanded more but the intellisense is confusing me haha. I have placed the Eval in between the opening tag of the link button and the closing tag of the link button. If I could extract this value (maybe as a string?) it might fix it. I have a hunch I should be able to, because you can extract values from text boxes as strings. ]]>
|
|
|
|
|
Arroci wrote: ]]>>
try Bind("ID")
Arroci wrote: Note: [xmlns:asp="#unknown">
you need either to check "Igore HTML Tag" or encode '<' & '>'
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Arroci wrote: Response.Redirect("~/NewsArticle.aspx?ID=" + this.GoToArticle)
No, I meant that you generate the link inside the databound control, and use Eval("ID") to emit the correct ID for each URL.
Arroci wrote: <asp:linkbutton id="GoToArticle" onclick="Go_To_Article" runat="server" xmlns:asp="#unknown">
Get rid of the onclick and instead add a URL that's something like ~/NewsArticle.aspx?ID=<%#Eval("ID")%>"
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Right so I got to work with your suggestions.
Yusuf:
Since I can only use Bind("ID") within a tag, i tried it under
Text='<%# Bind("ID") %> and it just threw up the same null error. It just seems that it's not picking up the record's ID key because the button is nested in a template.
Christian
I got your suggestion to partially work. basically, it now posts to the next page, but it doesn't post the ID, instead it posts (interestingly):
http:
From the code:
<itemtemplate>
ID:
<asp:label id="IDLabel" runat="server" text="<%# Eval(" xmlns:asp="#unknown" />
<asp:linkbutton id="GoToArticle" runat="server" postbackurl="~/NewsArticle.aspx?ID=<%#Eval(" xmlns:asp="#unknown">Go</asp:linkbutton>
</itemtemplate>
So I think this is some headway. I'll also be looking up methods of posting query strings from inside an item template but I think all of us are starting to get there .
I've been searching around and came across CommandArgument codes. They seem to be practicle for putting the <![CDATA[<%# Eval("ID") %>]]> in them. I'm currently looking at a way to use this in a query string. I had tried the following:
News.aspx
<asp:linkbutton id="GoToArticle" commandname="GoToArticle" xmlns:asp="#unknown">
CommandArgument='<%#Container.DataItem, ("ID")%>' runat="server">Go</asp:linkbutton>
and the code-behind:
private void DataList1_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
{
int ID = (int)e.CommandArgument;
if (e.CommandName == "GoToArticle")
{
Response.Redirect("~/NewsArticle.aspx?ID=" + ID);
}
}
}
Ironically, even though I'm getting the error:
No Overload Method 'ToString' takes '3' arguments
for line:
<asp:linkbutton id="GoToArticle" commandname="GoToArticle" xmlns:asp="#unknown">
CommandArgument='<%#Container.DataItem, ("ID")%>' runat="server">Go</asp:linkbutton>
I may have hit something good here. I just have to figure out how to stop the overload error! any help would be appriciated .
UPDATE: Ah! Okey guys I've managed to get the query to post to the next page! The commandargument and commandname methods were correct. More importantly, I needed to add OnItemCommand to the datalist's ASP tag! If anyone requests source I would gladly post a generic copy . I think after this I might actually post an article about implementing a button in a datalist to post ID values to another page, since it required a lot of cross referencing from google to get it done .
Christian: big thank you for hinting the right direction by using the Eval to render the link button.
Yusuf: big thank you as well for directing me to posting values from one page to another using a query string.
and thank you both for aiding me through this. Now I need to get the generic page to display the article. I'm trying
<asp:label id="Label1" runat="server" xmlns:asp="#unknown"></asp:label> with
protected void Page_Load(object sender, EventArgs e)
{
this.Label1.Text = Request.QueryString["ArticleID"];
}
at the moment, but to no avail
modified on Thursday, March 12, 2009 10:33 AM
|
|
|
|
|
nevermind I've managed to get the values to pass to the other page . The next step is to use this value to match it with the ID key of a database (which has been bound to a data control on the other page) to obtain the corresponding article. Any suggestions I'm open to .
|
|
|
|
|
I have a simple question. I am trying to display a jpg on my web page. I have a help.aspx page with this line of code but it does not display. I created a directory under App_Data named JPG and the jpg image is in there. When I use the intelisense, VS can locate the jpg, but when I run the page, the image is not displayed. I have tried using just a plain html page and it does not work either. I am missing something, but what?
<asp:image id="Image1" runat="server" height="300" style="border: 1px solid black; width:auto" imageurl="~/App_Data/JPG/Monitor1.jpg" alternatetext="Main Display Page" xmlns:asp="#unknown">
Thanks
|
|
|
|
|
you forgot the magic word Abracadabra
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Because you cannot have auto with Width property. assign something i.e. 200px and it will be fine.
|
|
|
|
|
Because App_Data is a protected ASP.Net folder.
Instead place your jpg file in the any other folder which is not a ASP.Net protected folder like (images folder under the root) and try.
Regards,
Cybernate
|
|
|
|
|
I want to create a web page where the left navigation bar and the content page can be changed by the end user.
I started by creating a master page. While I can get the main content page to show, I cannot get the left hand nav bar to show it's content. In the mater page I created a conten place holder for the main content and one for the left hand nav bar and in my LeftNav.aspx I put in the code to create a list. However when I run the page nothing shows up in the left content place holder.
Has anyone done something like this and if so can you comment on this?
Thanks
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Tom Wright wrote: content page can be changed by the end user.
what do you mean by this
Tom Wright wrote: I cannot get the left hand nav bar to show it's content.
where is the content coming?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
We have a content server where the user checks in a document. I grab the document from the content server and in the navbar content place holder use an include to mash in their links from the document.
Tom Wright
tawright915@gmail.com
|
|
|
|
|
Can you post the code for your master page?
Regards,
Cybernate
|
|
|
|
|
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="PolicySearch.master.cs" Inherits="ScholarPoliciesSearch.PolicySearch" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml" ><br />
<head runat="server"><br />
<title>Untitled Page</title><br />
<asp:ContentPlaceHolder ID="head" runat="server"><br />
</asp:ContentPlaceHolder><br />
<link href="Styles/Stylesheet.css" rel="stylesheet" type="text/css" /><br />
</head><br />
<body><br />
<form id="form1" runat="server" action="javascript:fxSearch();"><br />
<br />
<div id="HeaderContent"><br />
<br />
</div><br />
<br />
<div id="mainContent"><br />
<asp:ContentPlaceHolder ID="MainContent" runat="server"><br />
<br />
</asp:ContentPlaceHolder><br />
</div><br />
<br />
<div id="LeftNavBar"><br />
<asp:ContentPlaceHolder ID="leftNavBar" runat="server"><br />
</asp:ContentPlaceHolder><br />
</div><br />
<br />
<div id="FooterContent"><br />
<br />
</div> <br />
</form><br />
</body><br />
</html>
Tom Wright
tawright915@gmail.com
|
|
|
|
|
im developing an online test application using ASP.NET , IIS 7.0 is the server and SQL 2005 is our database engine. the user for a test must login first. i used session id s and variables to store names and login logout. but im having a problem with authentication .if on one computer im logged in as raj , then from a different computer i can still login as raj. how can i maintain unique logging in of users.really stumped. please help.
|
|
|
|
|
u can maintan with database flag...
but u should keep in mind..all the users will not click logout...they will close browser directly
modified on Wednesday, March 11, 2009 8:18 AM
|
|
|
|
|
The solution given by Rajesh is appropriate.
You can further enhance is as follows to automagically maintain/reset the flags:
1)Define a database level job to scan the users table for the active flags and the time they were marked and then reset the same after a specific amount of time.
2) Or add code to Session_OnEnd to mark the flag
3) or use and asynchronous javascript call on the page_unload event at client side to reset the flag.
Regards,
Cybernate
|
|
|
|
|
ur saying that i should create a flag field in my database , and everytime a user logs in set flag to 1, and then on logging out set flag to 0.right? is there any easier way?
|
|
|
|
|
Hi Dear
I want to use decode and encode technique between browser and server requests.
Please tell me some idea abt this..
Regards
Rajeesh MP
|
|
|
|
|
I am tring to integrate Pay Pal with my website. The website is in ASP.net 2.0 but the SDK That I have downloaded from net(cms.paypal.com)
is in ASP.net 1.1. I have created a different virtual directory for the same. And have replaced the DLLs ( Log4net,Paypal_Base and Asp_netSamples_Nvp). But when I run the project in ASP.net 1.1 using visual studio 2003, even if add only the default form it displays an error saying
(Parser Error Message: The type 'ASPDotNetSamples.Default' is ambiguous: it could come from assembly 'c:\inetpub\wwwroot\PayPal\bin\PayPal.DLL' or from assembly 'c:\inetpub\wwwroot\PayPal\bin\AspNetSamples_Nvp.DLL'. Please specify the assembly explicitly in the type name.)
Please help me with how the Pay Pal can be integrated with the website?
Thanks in advance
Regards
Amandeep Bhullar
|
|
|
|
|
better u use nsoftware.IBizPayPalWeb.dll
Regards
Rajeesh MP
|
|
|
|
|
I registered one calendar control in the Master page, but when am adding that control in the content page it is not working, this control is working without master page.
Master page Register code as follows
<%@ Register Assembly="GMDatePicker" Namespace="GrayMatterSoft" TagPrefix="cc1" %>
Content Page adding control Code as follows
<cc1:GMDatePicker ID="GMDatePicker1" runat="server" CalendarFont-Names="Arial" InitialText="Select a Date">
<CalendarDayStyle Font-Size="9pt" />
<CalendarTodayDayStyle BorderWidth="1" BorderColor="darkred" Font-Bold="true" />
<CalendarOtherMonthDayStyle BackColor="whitesmoke" />
<CalendarTitleStyle BackColor="#E0E0E0" Font-Names="Arial" Font-Size="9pt" />
</cc1:GMDatePicker>
|
|
|
|
|
What Error message u r getting..??
|
|
|
|
|
Unknown Server Tag - cc1:GMDatePicker
|
|
|
|
|
compiling time or running time u r getting this error..??
u r using any DLL for that..??
Better use Ajax calender control
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Calendar/Calendar.aspx
|
|
|
|