|
I am wondering which would be beter here..
In the older ASP days I would place any global values that I needed to set into a asp file that would be included at the top of every other page in the system. I could tehn refer to those vars inside the page that they were included in.
I have been playing around with different ways of doign this now that I am getting into the ASP.NET stuff. I notice that I can place variables (and the properties that can get/set them) intothe global.asax file of my site and then refer to them by simply using 'Gloabl.<property_name>'.
Is there any advantage to one way Vs. the other? My thinking is that using the global.asax method might be a bit faster since it does not require a physical file to be read and included as part of the one being displayed. I don't however have any data to back this up.
Being new to the ASP.NET arena I am also wondering how to go about configuring some global functions. I would like to have several functions that would be used at various points int he site and am htinking that the global.asax might be a good way to make them available as well.
While I am on the subject of global things on a web site, what about instances of classes? I was considering creating a class of User that I could us through out the site, but I am at a loss as to where I would creat an instance of it, as well as when I would destroy it. It would be handy to simply create a an instance of it on my login page, then have it worry about user validation to the DB on the backend, returning a property for authenticated or not, but how to I take care of it when the user 'logs off' so to speak.
Thanks for any insight anyone here can provide...
|
|
|
|
|
Ray Cassick wrote:
I was considering creating a class of User that I could us through out the site, but I am at a loss as to where I would creat an instance of it, as well as when I would destroy it.
I was thinking of the same. Although I havent worked with Cookies I think that will be the best option. Then use the variables you stored to recreate a User class for the page on load. Thats sounds like the "logical" way to do it.
Maybe the User instance class can be set as a Session Variable, that could work too I think....So we would retrieve Cookie values at session start make User class, validate with DB , and persist it for the remainder of the session.
I would probably have a look at this over the weekend, so if I find more info I will let you know
Cheers
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
No idea which would be the faster way of using global values but I'd imagine Global.asax is the least bug-prone (not relying on you to remember to include it). You can also use a module for things like this.
The same applies to functions.
As for user verification, it's worth SERIOUSLY considering Forms Authentication. Takes all the work out of it for you.
This article[^] is quite a complicated example and it's still a lot more simple than coding a cheap and nasty authentication yourself .
There's a nice explanation of Forms Authentication in O'Reilly's Inside ASP.NET if you have access to Safari.
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
Paul Riley wrote:
You can also use a module for things like this.
I was going to consider this. If I create a module, doe sit matter where I create it? Can I assume that puting it in any directory is ok as long as I make the functions that it contains public?
|
|
|
|
|
I don't see why it wouldn't work if it's in the same application as the calling page somewhere. I've only ever used a module where all my pages are in one folder, so don't quote me on that, but so long as it's in the right namespace it should be fine. Even if it's not, you can probably reference it.
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
does anyone know of anything i can do [rituals, chanting, electric shock] that will help me come up with a new website design? how do u lot get inspiration?
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Please don't say your changing your own site. It's very cool as it is.
Regards,
Brian Dela
|
|
|
|
|
Brian Delahunty wrote:
Please don't say your changing your own site. It's very cool as it is.
well.....ummm......actually......i am
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Nnamdi Onyeyiri wrote:
well.....ummm......actually......i am
Well.... ummmm... why???
Regards,
Brian Dela
|
|
|
|
|
well......umm......i got sick of the old design
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Suppose. Thats a good enough reason. So.. Any ideas for the new one?
Regards,
Brian Dela
|
|
|
|
|
only one, but i dont really like it. and browsing the net doesnt help, it only makes me hate my ideas even more
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
I really should get around to finishing my site.. Well. I'd have to get around to starting it first I suppose.
Regards,
Brian Dela
|
|
|
|
|
got anything uploaded? url...
ps. just keeping this thread going on.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Nnamdi Onyeyiri wrote:
got anything uploaded?
Nope. Well.. Wait. There used to be something at http://snet.wit.ie/~brian[^] but I think I removed it.. yep. .I did.
Regards,
Brian Dela
|
|
|
|
|
Brian Delahunty wrote:
Nope. Well.. Wait. There used to be something at http://snet.wit.ie/~brian[^] but I think I removed it.. yep. .I did.
And yet, you left the link in.
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
Paul Riley wrote:
And yet, you left the link in.
I didn't check until after wether or not I left that site up. I suppose I shoudl have removed trhe link.
Regards,
Brian Dela
|
|
|
|
|
I do alot of browsing around to sights that have the same (or similar) subject focus, then I make notes on what I like, what I don't like... I use those notes in my design.
Hmmm Orange bar down the left side of the page, cool little mascott cartoon character at the top, rolling adds for some cash... Hmmmmm
|
|
|
|
|
Well,
You can get inspiration from anywhere but the best is other websites. There are so many ways to design a website. For example, look at yahoo, it is one ugly website...but it functionality is one of the best because you can easly navigate through it find what you need and when you come back to the website weeks..months...later you dont have to re-learn it. Other websites are all flash, but have no content. I am sure there are numerous books that you can find that will help, search on web design, user interface and human interface.
|
|
|
|
|
David Flores wrote:
yahoo, it is one ugly website...but it functionality is one of the best because you can easly navigate through it
Where is the 'makes me puke' smiley...
|
|
|
|
|
|
I have a datagrid with this definition:
<asp:DataGrid id="CatGrid" runat="server" CssClass="Grid_General" HeaderStyle-CssClass="Grid_Header" ItemStyle-CssClass="Grid_Item" AlternatingItemStyle-CssClass="Grid_AlternatingItem" AllowSorting="True" AutoGenerateColumns="False" DataKeyField="CategoryID" OnEditCommand="CatGrid_Edit" OnCancelCommand="CatGrid_CancelEdit" OnUpdateCommand="CatGrid_Update" OnDeleteCommand="CatGrid_Delete" OnSortCommand="CatGrid_Sort" Width="100%">
<Columns>
<asp:EditCommandColumn ItemStyle-Width="25px" EditText="<img border=0 Alt='Edit this category' src=./Images/Edit.gif>" CancelText="<img border=0 src=./Images/Cancel.gif>" UpdateText="<img border=0 src=./Images/OK.gif>" />
<asp:ButtonColumn ItemStyle-Width="25px" Text="<img border=0 Alt='Delete this category' src=./Images/Delete.gif>" CommandName="delete" />
<asp:BoundColumn HeaderText="ID" HeaderStyle-Font-Bold="True" ItemStyle-Width="30px" DataField="CategoryID" ReadOnly="True" SortExpression="CategoryID" />
<asp:TemplateColumn HeaderText="Name" HeaderStyle-Font-Bold="True" SortExpression="Name" ItemStyle-Width="150px">
<ItemTemplate>
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' ID="Label1" />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="EditCatName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' CssClass="TextBox" Width="150px" />
<asp:RequiredFieldValidator Id="ValidateEditName" runat="server" ControlToValidate="EditCatName" Display="dynamic">* Name is required</asp:RequiredFieldValidator>
</EditItemTemplate>
</asp:TemplateColumn>
.
.
.
</Columns>
</asp:DataGrid>
When user press on first field of first column,that row goes in edited mode and text box appear for that
row,then after he/she change the text there DataGrid1_Update event occur,in that event I put this code:
string strCol2 = ((TextBox)e.Item.FindControl("EditCatName")).Text;
but when I debug the program,the text is not updated and show the previous text.Any idea?
<html><b><FONT face="Lucida Handwriting, Cursive">Mazy</FONT></b></html>
<small><b>"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"</b>Kryptonite-3 Doors Down </small>
|
|
|
|
|
I have found the same problem and the solution is to create a TextBox variable, then call the Text function. You can not just cast the control, dont know why. Try:
<br />
TextBox ctrlTextBox = (TextBox)e.Item.FindControl("EditCatName");<br />
string strCol2 = ctrlText.Text.ToString();<br />
You might also wanna double check that FindControl returns a valid control.
Do you know which column you are in? Because you can get it by the following since you are in the UpdateCommand:
<br />
int nColumn = ...;<br />
int nIndex = this.MyDataGrid.EditItemIndex;<br />
TextBox ctrlTextBox = (TextBox)this.MyDataGrid.Items[nIndex].Cells[nColumn].Controls[0];
string strCol2 = ctrlText.Text.ToString();<br />
Hope this helps
|
|
|
|
|
I found the problem.It was about PostBack in Page_Load. Thanks
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hello,
Is there any thing available for tab control on client side using jabascript so that I can move from one page to another using the tab controls without going back to the web server for each tab page.
Thanks
Hitesh
|
|
|
|