Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7819103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:48:02+00:00 2026-06-02T06:48:02+00:00

.NET pros out there I have a problem that i would like to share

  • 0

.NET pros out there

I have a problem that i would like to share with you and if possible get an advice:

I am loading a usercontrol dynamically using datalist. i am loading this usercontrol for each row i get from the database, it could be 30 different instanses of this control.

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…..

UserControl code behind:

public partial class SearchBullet : System.Web.UI.UserControl
{
public static int i = 0;
private string casterLOGO;

public string CasterLOGO
{
    get { return casterLOGO; }
    set { casterLOGO = value; }
}
private string casterNameSB;

public string CasterNameSB
{
    get { return casterNameSB; }
    set { casterNameSB = value; }
}
private string player1NameSB;

public string Player1NameSB
{
    get { return player1NameSB; }
    set { player1NameSB = value; }
}
private string player2NameSB;

public string Player2NameSB
{
    get { return player2NameSB; }
    set { player2NameSB = value; }
}
private string mapSB;

public string MapSB
{
    get { return mapSB; }
    set { mapSB = value; }
}
private string gameFrameSB;

public string GameFrameSB
{
    get { return gameFrameSB; }
    set { gameFrameSB = value; }
}
private string serieSB;

public string SerieSB
{
    get { return serieSB; }
    set { serieSB = value; }
}
private string race1SB;

public string Race1SB
{
    get { return race1SB; }
    set { race1SB = value; }
}
private string race2SB;

public string Race2SB
{
    get { return race2SB; }
    set { race2SB = value; }
}
private string castURLSB;

public string CastURLSB
{
    get { return castURLSB; }
    set { castURLSB = value; }
}
private string likeAmountSB;

public string LikeAmountSB
{
    get { return likeAmountSB; }
    set { likeAmountSB = value; }
}
private string qRYstring;

public string QRYstring
{
    get { return qRYstring; }
    set { qRYstring = value; }
}

protected void Page_Load(object sender, EventArgs e)
{
    if (IsPostBack == false)
    {
        i++;
        this.PreRender += new EventHandler(Cast_PreRender);

        this.ID = "Result" + i.ToString();  


    }
    PlayButton.ID = i.ToString();

}

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";

}
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;

}

}

The aspx page:

<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>

the problem is, after doing this, when i click the button nothing happens, i mean, when debugging, i never get inside the OnButton_Click event. if i delete the –> this.ID = “Result” + i.toString(); and the–> PlayButton.ID = i.ToString(); it’s ok.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:48:05+00:00Added an answer on June 2, 2026 at 6:48 am

    my solution was like this:

    instead of using an image buttom, i used Hyperlink.

    on_Load event of the usercontrol, i assigned to the src Attribute of the hyperlink all the properties of my user control and passed those using

    querystring to another page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Once the problem of loading plugins is solved (in .NET through MEF in out
.NET developers out there! Need your opinion here! I am now using Visual Assist
.NET newbie here... I'd like to make a button in a Windows form that
I know there have been questions in the past about SQL 2005 versus Lucene.NET
I have an unconventional legacy asp.net 1.1 web app that uses the src attribute
Anyone willing to help me out with pros/cons on .NET Remoting, Web Services, and
There are lots of mocking frameworks out there for .Net. There is no clear
What pros(positive sides) of using Spark view engine for ASP.NET MVC project. Why it
In Visual Studio 2008 ASP.NET in C#, what are the pros and cons of
What is the actual use of TempData collection in asp.net MVC, I need pros

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.