.NET pros out there
我存在一个问题,我要与你分享,如果可能的话,我会得到建议:
我正在动态地装上用户控制清单。 i 每一行都装上这种用户控制,从数据库中取出,这种控制可能有30个不同的情况。
when a user click the button, i want to be able to get the values of this specific usercontrol s properties, in my understanding, i heed the usercontrol ID to do that, thats why i want to assign my "custom id" to each loaded control so i will be able to find it later. maybe i am missing something, maybe this is not the best way, im open to suggestions. anyway.....
用户守则背后:
public partial class SearchBullet : System.Web.UI.UserControl
{
public static int i = 0;
private string casterLOGO;
public string CasterLOGO
{
get { return casterLOGO; iii
set { casterLOGO = value; iii
iii
private string casterNameSB;
public string CasterNameSB
{
get { return casterNameSB; iii
set { casterNameSB = value; iii
iii
private string player1NameSB;
public string Player1NameSB
{
get { return player1NameSB; iii
set { player1NameSB = value; iii
iii
private string player2NameSB;
public string Player2NameSB
{
get { return player2NameSB; iii
set { player2NameSB = value; iii
iii
private string mapSB;
public string MapSB
{
get { return mapSB; iii
set { mapSB = value; iii
iii
private string gameFrameSB;
public string GameFrameSB
{
get { return gameFrameSB; iii
set { gameFrameSB = value; iii
iii
private string serieSB;
public string SerieSB
{
get { return serieSB; iii
set { serieSB = value; iii
iii
private string race1SB;
public string Race1SB
{
get { return race1SB; iii
set { race1SB = value; iii
iii
private string race2SB;
public string Race2SB
{
get { return race2SB; iii
set { race2SB = value; iii
iii
private string castURLSB;
public string CastURLSB
{
get { return castURLSB; iii
set { castURLSB = value; iii
iii
private string likeAmountSB;
public string LikeAmountSB
{
get { return likeAmountSB; iii
set { likeAmountSB = value; iii
iii
private string qRYstring;
public string QRYstring
{
get { return qRYstring; iii
set { qRYstring = value; iii
iii
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
i++;
this.PreRender += new EventHandler(Cast_PreRender);
this.ID = "Result" + i.ToString();
iii
PlayButton.ID = i.ToString();
iii
void Cast_PreRender(object sender, EventArgs e)
{
PlayerName1.Text = Player1NameSB;
PlayerName2.Text = Player2NameSB;
CasterName.Text = CasterNameSB;
ImageRace1.ImageUrl = Race1SB;
ImageRace2.ImageUrl = Race2SB;
Map.Text = MapSB;
GameFrame.Text = GameFrameSB;
LikeAmount.Text = LikeAmountSB;
CasterLOGOIMG.ImageUrl = CasterLOGO;
PlayButton.AlternateText = "yay";
iii
protected void PlayButton_Click1(object sender, ImageClickEventArgs e)
{
Image img = (Image)sender;
string tt = img.AlternateText;
int j = 0;
Response.Redirect("default2.aspx");
// lb.Text = img.ClientID;
iii
iii
as页:
<asp:DataList ID="WatchLaterDL" runat="server" DataSourceID="SDSWatchLater" RepeatColumns="1">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<Search:Bullet runat="server" EnableViewState="false" ID="SearchResults" Player1NameSB= <%#Bind("Player_Name") %>
Player2NameSB= <%#Bind("Expr1") %> CasterNameSB= <%#Bind("Caster_Name") %>
Race1SB= <%#Bind("Race_1") %> Race2SB= <%#Bind("Race_2") %> MapSB= <%# Bind("Map")%>
GameFrameSB= <%#Bind("Game_Frame") %> LikeAmountSB= <%#Bind("Like_Amount") %>
CastURLSB= <%#Bind("Cast_URL") %> CasterLOGO= <%#Bind ("Caster_LOGO") %> />
</ItemTemplate>
<SeparatorTemplate>
<br />
</SeparatorTemplate>
</asp:DataList></div>
问题在于,在这样做之后,当点击 but子时,就没有发生任何事情,也就是说,在偷窃时,就永远不会在奥布托顿内。 Click活动。 如果删除,则删除。 ID = “Result” + i.toString(); and the->EmButton。 ID = i.ToString();它 s。
if there anything elese you might need to evaluate my problem, ill gladly prove and additional code needed. thank you very much for your help.