|
I need your help to write Add, Edit and Delete features. Here is the functionality details of the project:
1) SelectAll, ClearAll, Add, Edit and Delete is placed under FooterTemplate,
2) Textboxes for Name and Description is placed in FooterTemplate but its visible property is set to false, it has to be visible only if the Add button is clicked and SelectAll, ClearAll, Edit and Delete should become invisible
3) The edit and delete functionality should be enabled when any of the check box is selected and appropriate button is clicked
and the ASP Code is :
[code]
<![CDATA[<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>]]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="font-family: Tahoma; font-size: smaller">
<script type="text/javascript">
function Sel()
{
var frm = document.forms[0];
for(i=0;i<frm.length;i++)>
{
frm.elements[i].checked=true;
}
}
function DeSel()
{
var frm = document.forms[0];
for(i=0;i<frm.length;i++)>
{
frm.elements[i].checked=false;
}
}
</script>
<form id="form1" runat="server">
<div>
<asp:gridview id="GridView1" runat="server" cellpadding="4" forecolor="Crimson" gridlines="None" xmlns:asp="#unknown">
AutoGenerateColumns="False" BorderColor="Crimson" BorderStyle="Dashed" BorderWidth="2px"
ShowFooter="True" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand"
OnRowDeleting="GridView1_RowDeleting" OnRowEditing="GridView1_RowEditing" OnRowCreated="GridView1_RowCreated"
OnRowUpdating="GridView1_RowUpdating">
<columns>
<asp:templatefield headertext="S. No.">
<itemtemplate>
<asp:label id="Check" runat="server" text="<%# Bind("sno") %>"></asp:label>
</itemtemplate>
<footertemplate>
<asp:linkbutton id="SelectAll" text="Select All" runat="server" forecolor="White"></asp:linkbutton>
<asp:textbox id="nametb" runat="server" visible="false"></asp:textbox>
</footertemplate>
</asp:templatefield>
<asp:templatefield headertext="Name">
<itemtemplate>
<asp:label id="lblName" runat="server" text="<%# Bind("name") %>"></asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox id="ename" runat="server" text="<%# Bind("name") %>"></asp:textbox>
</edititemtemplate>
<footertemplate>
<asp:linkbutton id="ClearAll" text="Clear All" runat="server" forecolor="White"></asp:linkbutton>
<asp:textbox id="Desctb" runat="server" visible="false"></asp:textbox>
</footertemplate>
</asp:templatefield>
<asp:templatefield headertext="Description">
<itemtemplate>
<asp:label id="lblDesc" runat="server" text="<%# Bind("Description") %>" width="300"></asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox id="edesc" runat="server" text="<%#Bind("Description") %>"></asp:textbox>
</edititemtemplate>
<footertemplate>
<asp:button id="Add" runat="server" text="Add" width="50" font-names="Tahoma" commandname="add" />
<asp:button id="Edit" runat="server" text="Edit" width="50" font-names="Tahoma" commandname="edit" />
<asp:button id="Delete" runat="server" text="Delete" width="50" font-names="Tahoma">
CommandName="delete" />
</asp:button></footertemplate>
</asp:templatefield>
<asp:templatefield>
<itemtemplate>
<asp:checkbox id="SelectRow" runat="Server" />
</itemtemplate>
</asp:templatefield>
</columns>
<footerstyle backcolor="Crimson" font-bold="True" forecolor="White" />
<rowstyle backcolor="White" forecolor="Crimson" bordercolor="Crimson" borderwidth="2px" />
<pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center" />
<selectedrowstyle backcolor="#FFFFC0" font-bold="True" forecolor="Crimson" />
<headerstyle backcolor="Crimson" font-bold="True" forecolor="White" />
<alternatingrowstyle backcolor="#FFE5E5" bordercolor="#FFCCCC" forecolor="Crimson" />
</asp:gridview>
<asp:label id="Label1" runat="server" xmlns:asp="#unknown"></asp:label></div>
</form>
</body>
</html>
[/code]
My requirement is not to use SQLDataSource rather Data through code.
The ideal output of the GridView looks like this : http://picasaweb.google.co.in/srihariacha/GirdView
Kindly help me !
Regards,
Sri Hari Acha
|
|
|
|
|
This reads like you're asking us to write it for you. You can use any data source you like, but without persistence of some sort, what's the point of adding and editing data that will be lost ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi All,
I involved in developing a web project, I do login page to new users can registered on my web page. the problem how I can user maintain in all pages he navigate to. any help plz.
Regards
|
|
|
|
|
I user Sessions. Basically, when a user logs in , i carry the Username, to Display a message like Welcome "James" and each and every page i check if the Session is new, that means i chech if the Session variable is empty if its new, the user must be redirected to the login page. Now when the User logs off , i abandon the Session.
Hope it helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
thanks a lot that was very helpful.
King Regards
|
|
|
|
|
Session variables are the best option to use it.Also you can use some database for logging the details of every user.
Cheers!!
Brij
|
|
|
|
|
As the others have mentioned, use session variables. Do make sure when you are done with the user's session variable to delete it when finished. Otherwise, you will eventually (as this may take a very long time to have happen) run out of memory on the server where the values are kept.
"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
|
|
|
|
|
The one step no-one else mentioned, is to create a new base page, which redirects to the login page if the user is not already logged in. From there, it just works.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Good point.
"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
|
|
|
|
|
Would you believe I inherited a project that didn't bother to do this ? If you went to a URL inside the site directly, it would just work, or blow up on the basis of missing sessions variables ( not the login, all sorts of other stuff was being stored in the session and never checked when it was accessed ).
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: I inherited a project that didn't bother to do this
Oh boy, I bet that was loads of joy fixing that up.
"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
|
|
|
|
|
That was just one example, that whole site was a nightmare. The other big thing that blew my mind was that all session variables were strings, and all strings were typed in everywhere. I actually found code like this:
if (Session["WeShouldDoStuffNow"] == "YES")
when doing some searching proved that it was only ever set to Yes, or No. I obviously centralised all the 'WeShouldDoStuffNow' values to a class, so that there were never typos, but I gave up, I defined YES and NO rather than move to bools.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: session variables were strings, and all strings were typed in everywhere
Those can be a problem. Session variables are going to be a part of my discussion this up coming Tuesday evening in my VB.NET class I teach. I try to emphasize the importance of doing something like:
Dim MyUser As String = "UserName"
If Session[MyUser] blah blah blah blah Then
....
is easier and safer to work with than having the variable name inside quotations. It is a point I try to get across, and usually get mixed mileage every semester.
"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
|
|
|
|
|
Yeah, I would create a class that contains all the strings, and use it throughout the site. It's hard to believe that anyone would fail to understand how important that is, once it's explained to them.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: would create a class that contains all the strings, and use it throughout the site.
Hmmmm, that sounds like a nice little final exam problem [evil grin]...
Christian Graus wrote: It's hard to believe that anyone would fail to understand how important that is, once it's explained to them.
It happens from time to time, usually the student who is too busy IM'ing someone and not paying attention to the discussion. After they spend about two hours trying to debug the errors caused by the typos, it finally clicks.
"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
|
|
|
|
|
*grin* there's no teacher like experience, I guess.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
- I am building a discussion forums website similar to CP forums
- I have a search page where the user can save its criteria in something named SearchAgent
- This SearchAgent fires itself periodically and if it found new results it shall notify its owner
My idea is:
- I will create a windows service on the server side
- On that service I will create an event handler for the clock tick
- Each period of time X, I will fire all SearchAgents and if any returned new results, the service will notify the owner of that SearchAgent
If I missed something, please correct me before I start.
Thanks
foreach(Minute m in MyLife)
myExperience++;
modified on Sunday, November 30, 2008 7:03 AM
|
|
|
|
|
I don't know why would you need a timer. Since you are storing the messages to a database, you obviously have code which handles the replies.
Can't you simple add email sending to this part of your application (when a reply is stored). Depending on your solution, you can send the message from .Net code or from database when a row is added.
|
|
|
|
|
You are right
I just tried to simplify me request, but the actual situation is as follows:
- I have a search page which allows the user to save the search criteria in something called SearchAgent.
- The user can enable that SearchAgent to fire itself and notify him if there is new messages in the result.
- The service I try to create is to fire that SearchAgent and send the notification.
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Okay, I see. With those requirements, I think your original concept sounds reasonable.
Only thing that comes in mind is that if you create a windows service for this, the mechanism is vulnerable if the service stops for some reason. Also you may have problems if you want to use several servers to divide the load between servers. Which server has the service or if they all have it, how to prevent a situation where all services make the same queries and send emails.
So basically what I'm trying to say is that if you can somehow put the search mechanism to your application logic or into the database your solution could be more scalable. For example, in database you could have a job which searches for messages to notify and writes information about them to a separate table, kind of a queue. After that your application side checks the queue and sends the emails (part of normal message processing) or the database can send them if you want (of course this is database dependent, but at least SQL Server and Oracle can handle this).
|
|
|
|
|
Thanks for cooperation
Mika Wendelius wrote: After that your application side checks the queue and sends the emails
What you mean by application side?
Remember it is a web application. the application logic runs only when a client logs in to my website. So, I think that windows service still better
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
By application I meant the web server since you have two layers where to implement the logic, web server (either in the code serving the web client or in a windows service) or database.
|
|
|
|
|
Hi all
I have a delete form, in this form i have a drop down that consists of users, all that I need is when the user clicks on the delete button, the selected user will be deleted, it works, but the deleted name is still in the list.
How can I refresh the cache
here is the code...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim conn2 As New OleDbConnection
conn2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\WebSites\NandN\DB\nAndN.mdb;Persist Security Info=False"
conn2.Open()
Dim cm2 As New OleDb.OleDbCommand
cm2.Connection = conn2
cm2.CommandText = "delete from news where n_id=" & DropDownList1.SelectedValue & " "
cm2.ExecuteNonQuery()
Response.Redirect("adminDeleteNews.aspx?flag=1")
Button1.Enabled = False
conn2.Close()
cm2.Dispose()
Catch ex As Exception
Response.Write(Err.Description)
End Try
End Sub
Regards.
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
You have to bind the dropDown list again with the data source after u deleted the record from Database .
|
|
|
|
|
it works
thanks alot
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|