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 6128451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:37:43+00:00 2026-05-23T16:37:43+00:00

I have the following itemTemplate in my datalist <ItemTemplate> <asp:LinkButton ID=LinkButton1 CommandName=Select autopostback=True runat=server>'<%#

  • 0

I have the following itemTemplate in my datalist

          <ItemTemplate>
 <asp:LinkButton ID="LinkButton1" CommandName="Select" autopostback="True" runat="server">'<%# Eval("ThreadTitle") %>'</asp:LinkButton>

            </ItemTemplate>

This is my dataList mark up:

   <asp:DataList ID="DataList1" runat="server" 
            DataSourceID="AllQuestionAskedDataSource"
            GridLines="Horizontal" DataKeyField="ThreadsID" >

This is the sqldatasource:

<asp:SqlDataSource ID="AllQuestionAskedDataSource" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CP_AllQuestionsAnswered %>" SelectCommand="SELECT ThreadTitle, ThreadsID
    FROM Threads
WHERE UsersID=@UserID" onselecting="AllQuestionAskedDataSource_Selecting">

I am trying to use one of the following events handlers:

protected void DataList2_SelectedIndexChanged(object sender, EventArgs e)
{

}
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{

}

What I want to obtain in one of those event handlers the ThreadID associated with the row selected (by clicking on the row in the datalist) and get the ThreadTitle parameter from the specific row selected..

How can I achieve that task?

I basically want to retrieve the sql parameters that i feed into the sqldatasource, relating to the specific row clicked!!

Solved it myself:

    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
    LinkButton link = (LinkButton)e.Item.FindControl("LinkButton1");
    string threadTitle = link.Text;

    string recordID = (DataList1.DataKeys[e.Item.ItemIndex]).ToString();
    string special = "";
}
enter code here
  • 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-05-23T16:37:43+00:00Added an answer on May 23, 2026 at 4:37 pm

    You can do like..

    protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
    {
        // Will give you current data key value
        Int32 threadID = Convert.ToInt32(e.CommandArgument); 
        // if you want value of your control
        (ControlTypd)e.Item.FindControl("ControldId")
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following DataList: <asp:DataList ID=values Visible=false runat=server DataKeyField=Id> <ItemTemplate> <div id=row style=height:
I have the following repeater <asp:Repeater id=weatherFeed Runat=server><ItemTemplate> <asp:LinkButton runat=server id=PickInfo onClick=Selection_PickInfo> <img src=images/mapPin.png
I have the following (trimmed) markup: <asp:Repeater ID=CostCategoryRepeater runat=server> <ItemTemplate> <div class=costCategory> <asp:Repeater ID=CostRepeater
Lets say I have the following: <asp:Repeater ID=repSubItems runat=server DataSource=<%# SubItems %> > <ItemTemplate>
I have the following datagrid: <asp:DataGrid runat=server ID=gastosReembolsables ShowFooter=True AutoGenerateColumns=False> <AlternatingItemStyle CssClass=DATAitem2></AlternatingItemStyle> <ItemStyle CssClass=DATAitem1></ItemStyle>
In my repeater I have the following markup: <asp:Repeater runat=server id=TeamsRepeater OnItemDataBound=TeamsRepeater_ItemDataBound ClientIDMode=Predictable> <ItemTemplate>
I have the following repeater code: <asp:Repeater ID=repMain runat=server OnItemCommand=repMain_ItemCommand EnableViewState=false> <ItemTemplate> <dmg:testcontrol runat=server
I have the following checkboxes in my gridview: <asp:TemplateField HeaderText=Active> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, Active)%>
I have the following structure <asp:UpdatePanel ID=MyUpdatePanel runat=server> <ContentTemplate> <asp:MultiView ID=MyViews runat=server> <asp:View ID=List
I have the following code: <asp:FormView ID=PhotoFormView runat=server DataKeyNames=PhotoID DataSourceID=PhotoDataSource> <EmptyDataTemplate> No photo here.

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.