Also the script tag should be written as...
<script type="text/javascript"> ... </script>
The attribute language has been deprecated a while now.
Also the script tag should be written as...
<script type="text/javascript"> ... </script>
The attribute language has been deprecated a while now.
I have changed my original code to work only by calculating the sum of rows that have 'Donation $' in the first column.
var trs = document.getElementById('cbtf_24').getElementsByTagName('tr');
var sum = 0;
for(var i = 0; i < trs.length; i ++) {
if(trs[i].childNode[1].className == 'fieldCell') {
var lbl = trs[i].getElementsByTagName('label')[0].innerHTML;
if(lbl.indexOf('Donation $') !== -1) {
sum += isNaN(trs[i].childNode[1].innerHTML) ? 0 : parseInt(trs[i].childNode[1].innerHTML);
}
}
}
document.getElementById('cbtf_24').innerHTML += '<tr> <td> Total </td> <td> ' + sum + ' </td> </tr>';
javascript is especially useful serverside, where ASP.NET is absolutely weak... ;) from this point on you can guess my answer. Or maybe we wouldn't need servers in the future...
Are you saying that javascript is useful serverside? Or is it intended to be sarcastic, i hope so!
I agree with sedgey about the hosting but any dynamically data driven site; daniweb, msdn, facebook, google etc. could not be entirely JavaScript this is a useless comparison as they require server side code be it ASP.Net, ASP, PHP etc. to perform some heavy lifting of data to output content to a page.
or use the built in method
session_destroy();
You may ask in ASP.NET forum, it'd be better.
This is the ASP.net forum?
And the best way to achieve this is definately a recursive function. I dont quite understand your database structure could you ellaborate. A simple example of something would be.
Database Table Structure
MenuItem
--ID
--Name
--ParentID
' MenuItem class, to hold an instance of an item
' Not the best of ideas to hold public instance variables but for this example it will suffice
Private Class MenuItem
Public Name As String = Nothing
Public ID As String = Nothing
Public Sub New(ByVal name As String, ByVal id As String)
Me.Name = name
Me.ID = id
End Sub
End Class
The above code is untested and leaves out your database requests to however you are implementing this. The only trouble with thei recursive method may be if you had say 50+ levels, you may find that requesting from the database for each node will slow you down. Another way to get around this would be to gather all the nodes at the begginning in a list then select them from this list at runtime using their ID's.
Hope it helps
Private Function OutputFiles(ByVal list As System.Collections.Generic.ArrayList(Of MenuItem)) As String
Dim html As String = "<ul>"
For Each item As MenuItem In list
Dim sql As String = String.Format("SELECT ID, name FROM MenuItem WHERE parentID = '{0}'", item.ParentID)
Dim innerList As System.Collections.Generic.ArrayList(Of MenuItem) ' Fire the above SQL statement and populate …
css works by nesting. so...
ul li
"li" is found below "ul"
li li
"li" is found below "li"
Example
<div>
<ul>
<li>
<ul>
<li>Text 01</li>
</ul>
</li>
<li>Text 02</li>
</ul>
</div>
ul li {
color:#aaaaaa;
}
ul ul li {
color:#ff3333;
}
The style for "ul li" will set all "li" elements found under a "ul" element to the color "#aaaaaa" in the example above this means all text will be of the color "#aaaaaa".
The second style for "ul ul li" will set all "li" elements found under a "ul" which is found under a "ul" to the color "#ff3333". Only the text "Text 01" will be of this color as it is the only "li" element that has been nested within two "ul" tags.
Hope this helps clarify.
onclick="window.open('popup.aspx?textbox=txtDate','cal','width=250,height=225,left=270,top=180')"
href="javascript:;"
Try
onclick="window.open('popup.aspx?textbox=txtDate','cal','width=250,height=225,left=270,top=180');return false;"
href="javascript:void(0);"
And if that fails you could always try
onclick="var w = window.open('popup.aspx?textbox=txtDate','cal','width=250,height=225,left=270,top=180');w.focus();return false;"
href="javascript:void(0);"
I'm really having hard time importing ASPNETDB.mdf to remote server running sqlserver 2005..
I'm using sql server express edition (along with visual web developer 2008)
I use the same string
<add name="aspnetusers" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
No connection can be established....Then I changed that to
<add name="aspnetusers"
connectionString="server=(local);AttachDBFilename=ASPNETDB.mdf;Integrated Security=True;" providerName="System.Data.SqlClient"/>
I gives error
CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file ASPNETDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.I even copied(replicated) entire database to my remote server
but some stupid schematic version problem arises....My control panel is PLESK
Please help me out how to fix this common problem....
do you have permissions on this remote machine to create a database. you will need an account which has the nescessary permissions to auto generate a db.
You need to force the browser to refresh it looks like. Im afraid the easiest method is to change its name. maybe you could add a time to the end of the file i.e. "filename_20080607.jpg" etc.
you can use expressions but these are only picked up by internet explorer and are invalid css markup.
.className
{
width:expression(window.innerWidth ? window.innerWidth + "px" :
(document.body.offsetWidth ? document.body.offsetWidth + "px" :
"100%"));
}
The method you are using is depreciated and you should create your controls dynamically using the built in methods.
E.g.
HtmlInputCheckBox cb = new HtmlInputCheckBox();
cb.id = "someid";
cb.value = "your value";
/* Panel1 being a panel or some sort of placeholder on the page */
panel1.Controls.Add(cb);
When creating dynamic controls to access there variables on post back you need to re-initialise them.
Essentially recreating them (it sounds stupid)
Here is an example for you.
I see your using C# and im afraid that this is in VB.net from an old project. But its not very difficult to convert.
Just Create a new Website add this as a page and run it. (Again make sure its vb.net)
<%@ Page Language="VB" Strict="true" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim enuView As IEnumerator = ViewState.Keys.GetEnumerator
While enuView.MoveNext
Dim strKey As String = enuView.Current.ToString
If strKey.StartsWith("txt~", StringComparison.OrdinalIgnoreCase) Then
createTextBox(strKey, True)
ElseIf strKey.StartsWith("ddl~", StringComparison.OrdinalIgnoreCase) Then
createDropDownList(strKey, True)
End If
End While
End Sub
Protected Sub btnAddTextBox_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strId As String = "txt~" & Format(Now, "HHmmss")
createTextBox(strId, False)
End Sub
Protected Sub btnAddDropDownList_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strId As String = "ddl~" & Format(Now, "HHmmss")
createDropDownList(strId, False)
End Sub
Private Sub createTextBox(ByVal strId As String, ByVal isReturning As Boolean)
Dim txtBox As New TextBox
txtBox.ID = strId ' Set ID before if returning
plcDynamicContent.Controls.Add(txtBox) ' Add to page …
are you displaying tabular information ?
it very much looks like it.
one thing is tables are NOT bad. But are simply bad when using them for entirely different purposes than they were created for.
If you have tabular data use tables.
you dont need str_replace inside str_replace etc etc.
use two arrays
$your_txt = "Hello 'WORLD'";
$txt = array("'", "\"");
$txt_replace = array("\'", "\\\"");
$x=str_replace($txt, $txt_replace, $your_txt);
echo $x;
this way you can have two arrays and no messy inner replacements inside replacements.
although nav33n may have shown you his way as at first it appears easier (both do the same trick).
i have recently finished a project for one group which owns four companys and i had the opposite. they wanted identical sites with minor differences.
answer is dont fight your customer/client do it their way or you doint get paid!
offer critisism where nescessary if you think it will work better one way or antoher
an application that suggests final year projects maybe ?
really pick something youll enjoy (you will do a much better job)
ok obviously im not gonna do this all for you, but the best way of doing this is creating an object for each person which would contain all there details 'name, pledge etc' then you could do anything you please with the data. Or you could alternatively load all this data into an array by splitting the text file at every ",". Like so
while (dis.available() != 0) {
String data = dis.readLine();
String[] record = data.split(",");
System.out.println(record[2]);
System.out.println(record[3]);
// this would print 25 then 5
}
now you could do this for each record you have and store them in a multidimensional array (which isnt really true for java as it stores arrays of arrays)
but for you to understand this i suggest looking here http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html
its best to try and grasp the code ive shown above first and progress from there as you will inevitably have more loops. Post back with more questions if you have any.