|
Dear Developers
I'm reading and showing RSS in a Datalist. But I'm unsure how to get values from attributes having colon( : ). Like http://www.carmagazine.co.uk/car.rss[^] uses colon( : ) in field "cfi:lastdownloadtime".
When I use DataBinder.Eval(Container.DataItem, "title") in datalist, it give an error. Any idea how to access this attribute???
-- modified at 6:56 Wednesday 4th July, 2007
|
|
|
|
|
Hi,
I have an object tag as below.
<object id="basket" name="basket" classid="http:/public/bin/SmartControls.dll#Mycompany.SmartControls.DocumentDownload" height="0" width="0" viewastext="">
<param name="Protocol" value="<%= GetContextProtocol() %>" />
<param name="Domain" value="<%= GetContextDomain() %>" />
<param name="DocumentRetrievalURL" value="showDoc/Research.dox?docIDs=" />
And from the javascript I am calling a method present in this dll as below
function SmartClientDownload(XmlString)
{
var err = "";
try {
alert("basket = " + document.all("basket"));
basket.Context= XmlString;
basket.Download();
}
catch(e){
err="There was an error on this page.\n";
err+="Error description: "+e.description+"\n";
alert(err);
}
}
Here I get an error Object doesn't support this property or method.
Sometimes it work sometimes it fails, Let me know if you have faced this issue.
Thanks and Regards
Irsh
|
|
|
|
|
irsh_is wrote: Here I get an error Object doesn't support this property or method
Where in the code is it failing?
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
Hi Richard,
Thanks for responding.
I am getting the error in this statement.
basket.Download();
There is a method called Download() in the assembly which i am trying to access. It fails with the exception i have told before
Thanks
Irsh
|
|
|
|
|
hi,
could anyone correct my code to make cast between two generic list of object
public List<string> GetAllBrands()
{
List<tblbrand> ListBrand;
//this line of code contain an error
ListBrand = (List<tblbrand>)Product.GetAllObjects("Brand");
......
}
public static List<object> GetAllObjects(string ObjectName)
{
...
}
thanks in advance !!!
|
|
|
|
|
Are you looking to do something like this?
public List<TblBrand> GetAllBrands()
{
return Product.GetAllObjects<TblBrand>("Brand");
}
public static List<T> GetAllObjects<T>(string objectName)
{
...
}
|
|
|
|
|
Hi,
Please forgive my ignorance, as ive not done much development on the Microsoft side for a few years, and im just moving back onto .Net 2.
My problem is i am displaying a simple list of words from an SQL2005 DB. However i need to display the info alphabetically across three columns ie:
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
or even:
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
etc. How do i do this / which control is the best method? Im not properly aqauinted with the 'new' controls in 2.0
Thanks in advance.
|
|
|
|
|
Take a look at DataList. With this control you can define the number of rows or columns and the repeat direction.
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
|
in my application, there are some pages that are secured & some are non secure. all the pages are displayed in an iframe. how can i apply form authentication for secured pages?
Thanks & Regards,
SAMir Nigam,
Software Engineer,
STPL, Lucknow, India.
|
|
|
|
|
I am building an ASP.Net C# Web project. in the HTML form of the .aspx file
I have
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
SqlConnection conn = new SqlConnection("Data Source=DATA-SERVER;Initial Catalog=Intech;Trusted_Connection=true");
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM users WHERE username='"+Username.Value+"' AND password= '"+Password.Value+"'";
// Fill our parameters
cmd.Parameters.Add("@username", SqlDbType.NVarChar, 64).Value = Username.Value;
cmd.Parameters.Add("@password", SqlDbType.NVarChar, 128).Value = Password.Value; // Or "sha1"
// Execute the command
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
// Create a new ticket used for authentication
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Ticket version
Username.Value, // Username associated with ticket
DateTime.Now, // Date/time issued
DateTime.Now.AddMinutes(30), // Date/time to expire
true, // "true" for a persistent user cookie
reader.GetString(0), // User-data, in this case the roles
FormsAuthentication.FormsCookiePath);// Path cookie valid for
// Encrypt the cookie using the machine key for secure transport
string hash = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(
FormsAuthentication.FormsCookieName, // Name of auth cookie
hash); // Hashed ticket
// Set the cookie's expiration time to the tickets expiration time
if (ticket.IsPersistent) cookie.Expires = ticket.Expiration;
// Add the cookie to the list for outgoing response
Response.Cookies.Add(cookie);
// Redirect to requested URL, or homepage if no previous page
// requested
string returnUrl = Request.QueryString["ReturnUrl"];
if (returnUrl == null) returnUrl = "/";
// Don't call FormsAuthentication.RedirectFromLoginPage since it
// could
// replace the authentication ticket (cookie) we just added
Response.Redirect(returnUrl);
}
I have the table as
CREATE TABLE users
(
username nvarchar(64) CONSTRAINT users_PK PRIMARY KEY,
password nvarchar(128),
roles nvarchar(64)
)
CREATE INDEX credentials ON users
(
username,
password
)
Now I am trying to access the table but at
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
I am not getting any result from reader.Read();
I need help.
|
|
|
|
|
netwizerd wrote: cmd.CommandText = "SELECT * FROM users WHERE username='"+Username.Value+"' AND password= '"+Password.Value+"'";
// Fill our parameters
cmd.Parameters.Add("@username", SqlDbType.NVarChar, 64).Value = Username.Value;
cmd.Parameters.Add("@password", SqlDbType.NVarChar, 128).Value = Password.Value; // Or "sha1"
Fill out what parameters? You aren't using any parameters in the SELECT statement.
To use the parameters you should write:
cmd.CommandText = "SELECT * FROM users WHERE username=@username AND password=@password";
netwizerd wrote: I am not getting any result from reader.Read();
Perhaps the data does not exist. Or...
netwizerd wrote: reader.GetString(0), // User-data, in this case the roles
The first column isn't the roles. You've used SELECT * so in fact you don't know which column will be the roles because the columns will be returned in what ever order SQL Server decides is most efficient. You must use SELECT roles to ensure that the roles column is the first one.
By the way - for security you should also consider using a salted hash for storing passwords.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thank you Colin but I used username=@username AND password=@password before but still my SQLDataReader was empty it was producing any result.
Yasin
|
|
|
|
|
I do recommend using the Parameter route. They help prevent SQL Injection Attacks.
Have you tried writing the same query and running directly on SQL Server? Do you get any results?
I'm actually thinking that since you are only ever getting one value back (the roles) that ExecuteScalar would be better for your requirements (unless you are planning to get more data from the reader in the future)
ExecuteScalar retrieves one value only, the fist column of the first row. It will manage the data reader for you, so you don't have to worry about it. All you need to do is call ExecuteScalar instead of ExecuteReader and if the value isn't null you have matched the login.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Some people are just a bunch of ungrateful pricks! I did my best to answer the OP here by suggesting various things to look at for a problem that is not immediately apparent. But someone thought it was worthy of a 1-vote.
I think I'll concentrate on writing articles and organising events instead of trying to help out here.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Don't give up - I've 5 voted it to raise it up. I guess this was the same idiot who 1 voted an answer I gave earlier.
|
|
|
|
|
Pete O`Hanlon wrote: Don't give up
Thanks - I'll try not to give up completely but I've noticed that I'm responding less and less these days. I'm concentrating on presentations, articles and events more and more. That is much more rewarding.
Are you any good at presenting? Would you like to do a presentation in Glasgow sometime?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
It's been a while since I did any presentation type of work, apart from sales pitches. Now, if it's to come back up to Glasgow sometime, then I might just be persuaded.
|
|
|
|
|
I think I've figured it out - somebody's after your MVP status. You do seem to be the target of scattergun 1 voting.
|
|
|
|
|
Pete O`Hanlon wrote: I think I've figured it out - somebody's after your MVP status. You do seem to be the target of scattergun 1 voting.
Gosh! That's a bit sad isn't it.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Yup. Mind you, there are people who'll create two accounts just to vote themselves up.
|
|
|
|
|
Hi.
You guys know the type of functionality in CP where if you search for things in articles you can specify if you want the search terms to be highlighted in the results, right?
Does anyone know of an article or source code that does something like that?
I need to get it working in my project.
Thanks alot!
M
|
|
|
|
|
One way to do this would be to have a javascript function which would read the page and wrap the relevant text in spans (set the style of the span to have a background colour).
|
|
|
|
|
|
Than you.
I was searching around on the web as well, but probably not as efficiently as you were...;)
|
|
|
|