My name is elli and im doing some project for school, i will very much appreciate you advice.
I have a number of instances of a user control in my aspx page. the data in the user control i get from a datalist.
inside the control i have a button. what im trying to do is like that:
when a user clicks the button, i want to find out what row from the datalist is presented in this specific control, and store it in, lets say, session.
my problem right now is when i click the button, nothing happens, i tried just to put a simple Response.Redirect in the onButton_click in the code behind...
im working on it already 2 days and im kinda lost.
this is my user control ascx partial code: the image button is in the beggining
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class SearchBullet : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
String tmpcmd;
tmpcmd = (String)(Session["mainSearchQRY"]);
SqlDataSource1.SelectCommand = "";
SqlDataSource1.SelectCommand = tmpcmd;
}
protected void PlayButton_Click(object sender, EventArgs e)
{
Response.Redirect("Default2.aspx");
}
}
ellipertzov
Member
6 Points
20 Posts
how to get the data bound to an instance of a user control
Apr 09, 2012 05:31 PM|LINK
Hello to all the pros....
My name is elli and im doing some project for school, i will very much appreciate you advice.
I have a number of instances of a user control in my aspx page. the data in the user control i get from a datalist.
inside the control i have a button. what im trying to do is like that:
when a user clicks the button, i want to find out what row from the datalist is presented in this specific control, and store it in, lets say, session.
my problem right now is when i click the button, nothing happens, i tried just to put a simple Response.Redirect in the onButton_click in the code behind...
im working on it already 2 days and im kinda lost.
this is my user control ascx partial code: the image button is in the beggining
<div id="video play button icon" style="height: 27px; width: 121px; float: left"><asp:ImageButton ID="PlayButton" runat="server" ImageUrl="~/Search_Results_Images/search_Play_Button_Icon.png" onclick="PlayButton_Click" /> </div> <div style="height: 27px; width: 22px; float: left"> </div> </div> <div style="height: 15px; width: 434px; background-color: transparent; float: left"> </div> </div> </div> </ItemTemplate> <SeparatorTemplate> <div style="width:84px"></div> </SeparatorTemplate> </asp:DataList>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Data.SqlClient; using System.Data; using System.Configuration; public partial class SearchBullet : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { String tmpcmd; tmpcmd = (String)(Session["mainSearchQRY"]); SqlDataSource1.SelectCommand = ""; SqlDataSource1.SelectCommand = tmpcmd; } protected void PlayButton_Click(object sender, EventArgs e) { Response.Redirect("Default2.aspx"); } }