|
I'm sure not the expert, but what I found is that ABC is a child of the element node. To retrieve the value I use
val = node.FirstChild.Value;
try that.
|
|
|
|
|
Your program works when i run it...
using System;
using System.IO;
using System.Xml;
public class Sample {
public static void Main() {
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"<xml>
<element>ABC</element>
<element>ABC</element>
</xml>");
XmlElement root = doc.DocumentElement;
XmlNodeList nodeList = root.ChildNodes;
Console.Write(nodeList[0].InnerText);
for (int i = 1; i < nodeList.Count; i++)
{
Console.Write(","+nodeList[i].InnerText);
}
Console.ReadLine();
}
}
/\ |_ E X E GG
|
|
|
|
|
Hello.
I might be wrong, but InnerText will take all the text inside a node.
for examlple
<xml>
<element1>
<element2>ABC</element2>
</element1>
</xml>
the InnerText of element1 will be "<element2>ABC</element2>"
while value will only fork for childnodes
could this be right ?
-- modified at 2:16 Friday 10th March, 2006
|
|
|
|
|
That is what InnerXml does. InnerText get the values of the node and all child nodes.
I'm not sure if it ignores white space if the node only contains white space and children. The InnerText of element1 will either be "ABC" or "\r\n ABC\r\n".
---
b { font-weight: normal; }
|
|
|
|
|
I want to connect C# with analysis services of MS SQL server 2000. I have a code and it is giving me the error:
Database <db-name> does not exists.
I want to access OLAP cube data from that database and retrieve the data from it to web.
I m using Windows XP SP2 and IIS server.
Please ans my question as fast as possible...
It's very urgent.
Waiting for reply......
Thanks in advance.
SWAROOP
|
|
|
|
|
hey guys dumb doubt.. i have developed a messenger on C# .. but Iam not able to create a form component in C# (am using .Net Framework 2.0)which can display my smileys.. can some one suggest a solution or provide me with the url for the code please.!! I want to know how to display smileys along with my text coz right now it just displays text and no pictures for smiley.. please help..
codecrammer - CRAM LORD!!
|
|
|
|
|
textBox1.Text += ":-)"; scnr
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
|
|
Hello every body i am sorry for this question but i am beginer in web developing and i don't get it how to edit dada in gridview in net 2.0
please if some body can help me.
good bye
best regars
down i apply the text
DataSet ds = new DataSet();
ds = SqlFunction.EditBook();
if (ds != null)
{
//
DataView dv = new DataView();
dv.Table = ds.Tables["Table"];
// string str = ds.Tables[0].TableName.ToString();
// HttpContext.Current.Trace.Write("Table name=",str);
/* DataGrid datagrid1 = new DataGrid();
datagrid1.DataSource = dv;
datagrid1.DataBind(); */
GridView1.DataSource = dv;
GridView1.DataBind();
}
else
{
HttpContext.Current.Trace.Write("Error in EditBook");
}
|
|
|
|
|
<%@ Import Namespace="System.Data" %>
DataView CartView;
Double runningTotal = 0;
//Cart is a property on the Page
DataTable Cart {
get {
if (Session["DGC_ShoppingCart"] == null) {
DataTable tmpCart = new DataTable();
tmpCart.Columns.Add(new DataColumn("Qty", typeof(string)));
tmpCart.Columns.Add(new DataColumn("Product", typeof(string)));
tmpCart.Columns.Add(new DataColumn("Price", typeof(Double)));
tmpCart.Columns.Add(new DataColumn("GiftWrap", typeof(bool)));
Session["DGC_ShoppingCart"] = tmpCart;
// first load -- prepopulate with some data
for (int i=1; i<=6; i++) {
DataRow dr = tmpCart.NewRow();
dr[0] = "1";
dr[1] = "Product " + i.ToString();
dr[2] = 1.23 * (i+1);
dr[3] = false;
tmpCart.Rows.Add(dr);
}
return tmpCart;
}
else
return (DataTable)Session["DGC_ShoppingCart"];
}
}
void Page_Init(Object sender, EventArgs e) {
MyDataGrid.EnableViewState=true;
}
void Page_Load(Object sender, EventArgs e) {
CartView = Cart.DefaultView;
if (!IsPostBack)
BindGrid();
}
void BindGrid() {
MyDataGrid.DataSource = CartView;
MyDataGrid.DataBind();
}
void btnUpdate_click(Object sender, EventArgs e) {
for (int i=0; i<MyDataGrid.Items.Count; i++) {
DataGridItem _item = MyDataGrid.Items[i];
TextBox qtyTextBox = (TextBox)_item.FindControl("txtQty");
CheckBox giftCheckBox = (CheckBox)_item.FindControl("chkGift");
// with a database, we'd use an update command.
// since this is an in-memory datatable, we'll just change the in-memory row.
DataRow dr = Cart.Rows[i];
dr[0] = qtyTextBox.Text;
dr[3] = giftCheckBox.Checked;
}
BindGrid();
}
Double CalcTotal (int count, Double price) {
Double total = count * price;
runningTotal += total;
return(total);
}
Custom Editing with DataGrid
<asp:datagrid id="MyDataGrid" runat="server"
="" bordercolor="black" borderwidth="1" gridlines="none" cellpadding="4" font-name="Verdana" font-size="8pt" headerstyle-backcolor="#aaaadd" autogeneratecolumns="false">
<columns>
<asp:templatecolumn headertext="Quantity">
<itemtemplate>
<asp:textbox id="txtQty" runat="server"
="" text="<%# DataBinder.Eval(Container, "DataItem.Qty") %>" width="40px">
<asp:boundcolumn headertext="Product" datafield="Product">
<asp:boundcolumn headertext="Price" datafield="Price" dataformatstring="{0:c}">
<asp:templatecolumn headertext="Gift Wrap?">
<itemtemplate>
<asp:checkbox id="chkGift" runat="server"
="" checked="<%# (bool)(((DataRowView)Container.DataItem)["GiftWrap"]) %>">
<asp:templatecolumn headertext="SubTotal">
<itemtemplate>
<asp:label runat="server"
="" text="<%# String.Format("{0:c}",CalcTotal((Int32.Parse((string)(((DataRowView)Container.DataItem)["Qty"]))),((Double)(((DataRowView)Container.DataItem)["Price"])))) %>">
<footertemplate>
<asp:label runat="server"
="" text="<%# String.Format("{0:c}", runningTotal) %></b>">
<asp:linkbutton id="btnUpdate" runat="server"
="" text="Update Totals" font-name="Verdana" font-size="8pt" onclick="btnUpdate_click">
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Console.Write(".............");
x = Console.Read();
Console.Write(".............");
y = Console.Read();
When using above code, the second Console.Read() has been done automatically caused by the "Enter key" of the first one.
How can I solve this problem? How can I clear buffer of keyboard??
Hung
|
|
|
|
|
|
I appreciate your solution, but I want to use the Console.Read() for some purposes.
Do you have others solution???????
Hung
|
|
|
|
|
Can anyone plz tell me where can i download "longhorn SDK" not Longhorn OS.
Plz give me any link if you have.
Thanks in advance
Sheel
Sheel Gohe
|
|
|
|
|
|
I am defining an interface to a real-time engine. Based on inputs to the engine the engine may fire events. How do I build the code so that the eventhandler is on the other side of the interface from the engine? That is, my subscriber(s) is external to the engine. Seems to me I have to declare something in the interface specification.
Thanks.
|
|
|
|
|
If you are already defining an interface, events arent necessary. You simply call the methods on the interface and let the implemeter handle them. IMO better than the event approach, and alot faster due to direct calls.
Events in an interface is normally so the interface can 'notify' to the interface user.
|
|
|
|
|
Consider this diagram:
user <- interface -> engine
Based on your last e-mail, the target of the event within the engine is on the interface. How is it that the user is notified?
|
|
|
|
|
I think he's confused about your use of the word interface - he's thinking of an interface such as IDisposable, or ISerializable (though obviously defined by you), and it sounds like you mean interface as object layer that hides the engine.
Off the top of my head, I can think of two ways to do this:
1) Cascading events - When the interface is loaded, it subscribes to events in the engine. When the user connects to the interface, it then subscribes to events in the interface. When the engine raises the event, the interface gets notified to it's handler. It then raises the event the user subscribed to.
These cascading events will work, though performance may be a concern to you. It wasn't in an app I'm working on (at least in this area), and the events needed to be bubbled up quite a few layers, with each layer doing something with the event, so this mechanism worked fairly well.
2) Have a method defined in your interface that takes in a delegate as a parameter of the correct delegate type to the event you want to subscribe to. This interface method will use this delegate to subscribe to the engine event. When the engine raises the event, the user is notified without the interface getting in the way.
<br />
public void ConnectEvent(EventHandler h)<br />
{<br />
engine->TheEvent += h;<br />
}<br />
<br />
...<br />
interface->ConnectEvent(new EventHandler(user_EventHandler));<br />
I did something like this a while ago, but I don't remember why or how well it worked out.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
How to get window's size and position to javascript?
|
|
|
|
|
Hi, evrybody
---------
what is doing BreakPoint In C# Code?
Why we use BreakPoint ?
---------
---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------
|
|
|
|
|
it's used for debugging. You put one prior to where you have a peice of code that isn't working. When the program gets to that point it stops running and goes to the IDE where you can step through the code one line at a time to see what's going on.
|
|
|
|
|
thanks
---------------------
Areff Bahrami(KAVEH)
Areff.HB@Gmail.com
---------------------
|
|
|
|
|
make socket programming to use fifo (first in first out) and round robin algorithm.(lots of client and one destination)(source code)
|
|
|
|