|
Abubakarsb wrote: I tried but couldn't find a solution.
Ok, so what do you have so far?
Abubakarsb wrote: I try to send you code of XSL file.
Post it here, so anybody can see it and can help you.
Abubakarsb wrote: please send me c# lines of code to get value of this param in .cs file.
I'm not going to write the whole thing for you. If you get stuck at some point, I will help as best as I can, but you have to show that you at least tried yourself (by showing what you've got so far). Start by looking at the documentation of the XmlDocument class, its SelectSingleNode method and the continuative links. They contain many examples on how to work with XML and should give you a good starting point.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Code written in XSL File:
<<xsl:variable name="size" select="ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))" >="">
Code written in ..cs File:
XmlDocument xdoc = new XmlDocument();
xdoc.Load(URL);
xdoc.SelectSingleNode("xsl:variable");
|
|
|
|
|
Abubakarsb wrote: Code written in XSL File:
<
Cannot see the XSL.
Abubakarsb wrote: xdoc.SelectSingleNode("xsl:variable");
The XPath expression you used probably does not match anything. You have to specify a valid XPath expression to select the wanted variable element in the XSL document. For example this "//xsl:variable" will get you the first variable element. A first introduction the XPath can be found here W3Schools XPath[^]Furthermore, you have the overload of the SelectSingleNode method that takes an XmlNamespaceManager instance to resolve the prefixes used in the XPath expression to namespace URIs. Take a look at the documentation of the overload to see an example.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Code written in XSL File:
<xsl:variable name="size" select="ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))"/>
Code written in ..cs File:
XmlDocument xdoc = new XmlDocument();
xdoc.Load(URL);
xdoc.SelectSingleNode("xsl:variable");
|
|
|
|
|
Abubakarsb wrote: select="ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))"
Do you want to get the string of the select attribute or its real value? The latter is impossible I think, because it depends on a input document.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
YA I want to get value of this "ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))" not this one as a string.
Please tell me any way to get this value in .cs plz.
|
|
|
|
|
Abubakarsb wrote: YA I want to get value of this "ceiling(count(.//Category[Title=$subtitle]/Category/MetaData))" not this one as a string.
As I said, I do not think it is possible, because it is a dynamic value that depends on the document currently getting transformed.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
i m using sqlserver with c#.net making a window application.
i have a table 'dealerlogin', from which i want to fetch the last row of the table which is inserted through a query.
I want to fetch the last row to get one of its field 'logindatetime' to use it in my update query in 'where' clause.
i want to know how can i fetch the last row of the table.
i.e -- Counting rows of 'dealerlogin' table one by one till last row is found and putting 'logindatetime' field's value in a variable.
But i dont know how to implement it.
Hope for some help.
Thank you.
Nekshan.
|
|
|
|
|
Hi,
Which are the fields of the table? You can try to fill a dataset with a query where you order the rows of the table desc... For example, using an autonumeric field(if you have one)... Or better than this, getting only the field using the same query and ExecuteScalar method...
|
|
|
|
|
select top 1 * from tablename order by column asc/desc
Obviously use either asc or desc
|
|
|
|
|
' convert it onto c# this code is i writen in vb
' this answer is the question u ask how to get value in dataset through function
' now u bind that as
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'write this code place at which u want data.
Dim ds As New DataSet
ds = RmaSearchByDays("0065xyz", 10)
' if u want to access ds data then write
For i = 0 To ds.Tables(0).Rows.Count
Dim str As String = ds.Tables(0).Rows(0).Item(0)
' str contain value item(0) means column 0, item(1) means column 1 ok.
Next i
End Sub
Public Function RmaSearchByDays(ByVal ACCOUNT_REF As String, ByVal TotalDays As Integer) As DataSet
Dim cn As SqlConnection = New SqlConnection("write here connection strings")
Dim cmd As SqlCommand = New SqlCommand()
cmd.CommandText = "write here select statement where account_ref='" + ACCOUNT_REF + "'" + "and tdays =" + TotalDays
cmd.Connection = cn
Dim da As SqlDataAdapter = New SqlDataAdapter()
Dim dsResult As New DataSet
da.SelectCommand = cmd
da.Fill(dsResult)
' Return the dataset result
Return dsResult
End Function
End Class
' this question answer is
select top 1 * from tablename order by column_name desc
'column name is column which is unique number columnname ok
' if u not able to understand then replay me.
|
|
|
|
|
Hello all,
I am new to .net, m developing a small application, the problem i face is whenever there is a postback on my page the font size of the whole page increases. How can i avoid this ??
Any help would be appreciable.
Thanks in advance.
Deepak
|
|
|
|
|
Hi
If font size increases after postback, it means there is some javascript error.
If it so, but how to check?? Then double click on the left corner of your web browser. (Instead of text 'Done', text 'Done with some errors' will be displayed if there is an error in your .aspx). Error may be syntax error or Braces not enclosed etc...
Check it now. Hope you got it.
- Harini
|
|
|
|
|
Hello All,
I have a web page with login control binded to custom sql membershipProvider to authorise the user. I was trying to use GetUser() method to display username but it is giving an error, I think i need to override
Membership.GetUser() method as well becos i understand its not using my custom SQL membership provider to get the loginname but iam stuck dont know how to acheive that. can someone help me out here, please see code below.
Login.aspx.cs
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true)
{
Response.Redirect(
"Welcome.aspx");
}
}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
System.Data.SqlClient.
SqlConnection Con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
System.Data.SqlClient.
SqlCommand Cmd = new System.Data.SqlClient.SqlCommand();
Cmd.Connection = Con;
Cmd.CommandType =
CommandType.StoredProcedure;
try
{
Con.Open();
Cmd.CommandText =
"name";
Cmd.Parameters.Add(
"@UserName", SqlDbType.VarChar, 20);
Cmd.Parameters[
"@UserName"].Value = UserName;
Cmd.Parameters.Add(
"@Password", SqlDbType.VarChar, 20);
Cmd.Parameters[
"@Password"].Value = Password;
System.Data.SqlClient.
SqlDataReader reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
if (reader.HasRows)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
//Return False;
}
throw new Exception("The method or operation is not implemented.");
}
Welcome.aspx.cs (After user logs in he is redirected to this page)
protected
void Page_Load(object sender, EventArgs e)
{
MembershipUser CurrentUser = Membership.GetUser(true); [This gives me an error ]
Label1.Text = CurrentUser.UserName.ToString();
}
Thanks in Advance for your help. Best Regards
|
|
|
|
|
Hi
How to get all the tables with their schema name in sql server 2005.
I am using adventures database. I know how to display all the tables in the database.
select * from information_schema.tables where table_type='base table'
I want to append the owner name (dbo.sales, sales.product )
can any one help me to solve my problem please?
kesavan
kesavan
|
|
|
|
|
select Table_Schema+'.'+Table_Name as fullname from information_schema.tables where table_type='base table'
|
|
|
|
|
I got a static page where I got 2 textbox for user logon so they can log on remotely from home and can access their work folders (home directory) and save document. what are the steps needed please help.
thanks
|
|
|
|
|
hi,
May i know what this error refers to..
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Documents and Settings\user\Desktop\Naveed\WindowsApplication8\WindowsApplication8\Form1.cs 24 13 WindowsApplication8
Thank u
|
|
|
|
|
What is on the line the error refers to?
|
|
|
|
|
Hi All,
Kindly let me know the method, How to Maximize loaded program.
Example:
--------
Only Notepad is running on my system which is already minimized on the tray, and I want to maximize it using C# code.
Thank you
|
|
|
|
|
You need to p/invoke some windows api to achieve this. First you need to get the handle of the window that should be maximized and then use that hahndle to maximize it. Take a look at this these on pinvoke.net:
FindWindow (user32)[^]
ShowWindow (user32)[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Dear Mr. Stefan Troschtz
Thank you of your kind respons
|
|
|
|
|
My pleasure
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
I'm trying to use the Conditional Operator in C# in the form of
<bool condition> ? <true value> : <false value>;
and I want the value to return as NULL if the condition is false.
For example:
bool _validated = _boolText != null? bool.Parse(_boolText): null;
But an error occurs when trying to build.
Here is the error message:
Type of conditional expression cannot be determined because there is no implicit conversion between 'bool' and '<null>'
How can I solve this problem?
Thank you very much.
KiT
-- Never wait for a chance to come, Believe in your own potential and go get it! --
|
|
|
|
|
You must declare your boolean type variable to a nullable boolean, but this will only works in .NET 2005.
bool? _validated = _boolText != null ? bool.Parse(_boolText): null;
If you want to declare a nullable bool just add suffix "?" symbol to your datatype.
ex.
bool?
int?
string?
regards,
mark
-- modified at 1:51 Friday 23rd February, 2007
|
|
|
|