请使用数据表示控件的示例ItemCommand和ItemDatabound进行说明.
我必须平均划分行,所以在这里,例如,有15行.我想平均划分,这是三组,但我希望名称只出现在每组的第一个条目之前,如图所示:
DECLARE @NAMES TABLE
(
[ID] INT IDENTITY,
[NAME] VARCHAR(20)
)
INSERT INTO @NAMES
SELECT 'NAME1' UNION ALL
SELECT 'NAME2' UNION ALL
SELECT 'NAME3' UNION ALL
SELECT 'NAME4' UNION ALL
SELECT 'NAME5' UNION ALL
SELECT 'NAME6' UNION ALL
SELECT 'NAME7' UNION ALL
SELECT 'NAME8' UNION ALL
SELECT 'NAME9' UNION ALL
SELECT 'NAME10' UNION ALL
SELECT 'NAME11' UNION ALL
SELECT 'NAME12' UNION ALL
SELECT 'NAME13' UNION ALL
SELECT 'NAME14' UNION ALL
SELECT 'NAME15'
Run Code Online (Sandbox Code Playgroud)
期望的输出:
ID NAME
----------- --------------------
1 NAME1
2 …Run Code Online (Sandbox Code Playgroud) 我有关于Interface的问题.有2个接口都包含相同的Method Test().现在我继承了Sample类中的接口.我想知道将调用哪个接口的方法?我的代码示例如下:
interface IA
{
void Test();
}
interface IB
{
void Test();
}
class Sample: IA, IB
{
public void Test()
{
Console.WriteLine("Which interface will be implemented IA or IB???!");
}
}
class Program
{
public static void Main(string[] args)
{
Sample t = new Sample();
t.Test();//Which Interface's Method will called.
Console.ReadLine();
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢Vijendra Singh
我对引用类型有些困惑以下是测试示例请告诉我它是如何工作的
class TestClass
{
public int i = 100;
}
class MyTestClass
{
public void Method()
{
int i = 200;
var testClass = new TestClass();
testClass.i = 300;
Another(testClass, i);
Console.WriteLine("Method 1:" + testClass.i);
Console.WriteLine("Method 2:" + i);
}
public void Another(TestClass testClass, int i)
{
i = 400;
testClass.i = 500;
testClass = new TestClass();
//If we have set here again testClass.i = 600; what should be out putin this case
Console.WriteLine("Another 1:" + testClass.i);
Console.WriteLine("Another 2:" + …Run Code Online (Sandbox Code Playgroud)