- 列 A と列 E のデータ型は何ですか?
- どのように拘束していますか?データソース ID? データソース/データバインド()?
- リピーターにはどのようなマークアップがありますか?
プレゼンテーション レイヤー (aspx ページ) ではすべて単なる文字列なので、リピーターをいずれかの結果にバインドできる可能性があります。両方とも 4 つの列があるためです。
すでに持っているものを示していないため、これ以上の支援を提供することは困難であり、最適なソリューションはプロジェクトの詳細に大きく依存します。
編集
よし、バインドするだけです。まだ試していませんか? 最初に何かを試したことがない場合は、技術的な質問をするときにわかるでしょう。
より良い質問は次のとおりです。「リピーターを、1列だけ異なる2つの異なるストアドプロシージャにバインドしようとしましたが、エラーが発生しました(正確なエラーメッセージを説明してください)。これが私のコードです...誰か助けてください?」
考えられる解決策
aspx
<asp:Repeater ID="repeaterId" runat="server"
OnItemDataBound="RepeaterId_ItemDataBound">
<HeaderTemplate>
[table rows and columns structure]
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:Literal ID="literalId" runat="server"></td>
<td><% # eval("column2")%></td>
<td><% # eval("column3")%></td>
<td><% # eval("column4")%></td>
</tr>
</ItemTemplate>
aspx.cs
protected void RepeaterId_ItemDataBound(Object Sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Literal lit = e.FindControl("literalId") as Literal;
if(null != lit)
{
if(usingStoredProcedure1)
{
lit.Text = Databinder.Eval(e.Item.DataItem, "A");
}
else
{
lit.Text = Databinder.Eval(e.Item.DataItem, "E");
}
}
}
}
private void BindRepeater()
{
if(someCondition == true)
{
repeaterId.DataSource = getStoredProcedure1();
}
else
{
repeaterId.DataSource = getStoredProcedure2();
}
repeaterId.DataBind();
}