|
I have a GridView that is on an ASP.NET page. I want to know what the current row is that is being edited. If I used gvCustomers.EditIndex it returns the last value the edit row was, -1 if it is the first time trying to edit. This isn't the current one that will need to be used after the PostBack has been preformed.
Is there another method I need to be putting this code into to get the value I need?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
string[] a = new string[1000];
a[0]="0";
a[1]="1";
a[2]="2";
//......
a[999]="999";
//err
string abc = string.Format("abc{1}..{2}...{1000}...",a);
I want to array insert value to string "abc". Number value fill very much
Do i have to write code by ???
Can you help me
|
|
|
|
|
saytinh wrote: Do i have to write code by ???
C#
Regards,
Satips.
|
|
|
|
|
No, that won't work (nor will the subject line).
You'll either need to write out each array member
string abc = string.Format("abc{1}..{2}...{1000}...",a[0], ... 1[1000]);
Or use a loop. (In which case a StringBuilder may be a good idea.)
Something like:
<br />
System.Text.StringBuilder abc = new System.Text.StringBuilder ( "abc" ) ;<br />
foreach ( string s in a ) abc.Append ( s ) ;<br />
|
|
|
|
|
I have a string:
"
[Layer]
[Shape_Area]
[Shape_Leng]
"
[...] is Column Name in Database.
When I set [...] in string. Print data in database defend Column Name.
Quality Column Dynamic.
|
|
|
|
|
I'm not sure I follow that, but do you want something like this?
string abc = string.Format (@"
<html>
<head>{0}</head>
<body>
{1}
{2}
</body>
</html>"
, dr [ "Layer" ]
, dr [ "Shape_Area" ]
, dr [ "Shape_Leng" ]
) ;
(Where dr may be a DataRow, or possibly a DataReader?)
|
|
|
|
|
i think not use Because fill Dynamic column .When fill 1 col, When fill many col.
client respond : "...[Name_col7]...[Name_col5]..."
app use this string to fill allow Name_col
respond to client new string.
|
|
|
|
|
The best way to do this, is to write a loop and use a stringbuilder. Assuming the strings between the values are consistently the same.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I tried a VS Integration Package, which will add a toolbar to the visual studio 2005.
Now, It can work on the machine with SDK installed.
But, if the SDK is not installed, the Package will be seen and can't work.
Appreciate your suggestion.
|
|
|
|
|
What SDK ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Visual Studio 2005 SDK 2007.2
Add a toolbar button to the VS2005 IDE.
|
|
|
|
|
Hi,
Are there any difference in performance between these codes:
<br />
MyClass _myClass = new MyClass();<br />
string _myString = "";<br />
_myString = _myClass.GetMyString();
and
<br />
MyClass _myClass = new MyClass();<br />
string _myString = _myClass.GetMyString();
In the first case, the string variable has been explicitly initialized.
While in the second case, it has been implicitly initialized.
Well, I understand that the difference in performance cannot be noticed.
But I'm just curious to learn about it.
Thank you very much.
-- modified at 22:15 Wednesday 20th June, 2007
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
If you replace "" with string.Empty, then I think performance will be equal.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
So you mean in this scenario, the second case (implicitly initialization) yields better performance?
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
yes, because the first creates an empty string, which is then discarded. string.Empty maps to an empty string that already exists, so doesn't cost anything.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I see. Thank you very much.
KiT
Never wait for a chance to come, Believe in your own potential and go get it!
|
|
|
|
|
KiTsuNeKo wrote: Never wait for a chance to come, Believe in your own potential and go get it!
You can use Reflector[^] to investigate MSIL code...
|
|
|
|
|
I want to multiply 2 XML nodes and want to append the result in another XML node in C#.What will be the code.If there is already exist one XML file there.I want to do the coding in a Class File.
|
|
|
|
|
Select the nodes, grab the values, multiply them and stuff the result in.
What specific part are you stuck on ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This is the code:
This code is actually calculating one specific node with a user defined rate value.But this code I made for one sample windows application.
But now I need only one class file where no user defined rate is there.
rate is also available in the XML file.
And these code is for one specific node.I need to do the calculations for each and every nodes where Attribute is mention as coverage.
public void CalculateCommissionAmount(string policyXML, string rate)
{
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(policyXML);
XmlElement root = xmldoc.DocumentElement;
if (Convert.ToDouble(rate) < -5)
{
MessageBox.Show("Invalid Rate - Rate cannot be less than -5%.");
}
else if (Convert.ToDouble(rate) > 100)
{
MessageBox.Show("Invalid Rate - Rate cannot be more than 100%.");
}
else
{
try
{
XmlNodeList xmlnode = xmldoc.GetElementsByTagName("PersonalAutoVehicle");
for(int i=0; i
|
|
|
|
|
saymajum wrote: .I need to do the calculations for each and every nodes where Attribute is mention as coverage.
OK, so you need to use SelectNodes where the attribute exists. XPath allows you to do this.
Use SelectNodes, not GetElementsByTagName. XPath is a lot more flexibile than that.
use double.TryParse, not convert.ToDouble, that will tell you without throwing an exception if the conversion is not possible.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks a lot I am trying in that way
|
|
|
|
|
How to loop in every nodes of a XML file through C# codes
|
|
|
|
|
Assuming it's in an xml document, you can use the SelectNodes method to get through a list of nodes, then you'd need to recurse from there.
However, I believe that an XmlReader just steps through them, that may be better/easier.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks,
But my scenario is:
There is a already existing Xml file.I have to take to nodes from there multiply it and result will come in the 3rd node that will be created dynamically.Coing in C#.
|
|
|
|