Last post Apr 13, 2012 02:36 PM by ellipertzov
Apr 09, 2012 06:31 PM|ellipertzov|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 style="height: 27px; width: 22px; float: left">
<div style="height: 15px; width: 434px; background-color: transparent; float: left">
this is the ascx.sc code
public partial class SearchBullet : System.Web.UI.UserControl
protected void Page_Load(object sender, EventArgs e)
tmpcmd = (String)(Session["mainSearchQRY"]);
SqlDataSource1.SelectCommand = "";
SqlDataSource1.SelectCommand = tmpcmd;
protected void PlayButton_Click(object sender, EventArgs e)
thank you very much,
Apr 09, 2012 06:41 PM|nirman.doshi|LINK
Your mark-up says - PlayButton_Click
And your cs file does not have it, rather it has - btnClick_Click.
is it the case really, or is it just a typo?
Apr 09, 2012 07:00 PM|ellipertzov|LINK
it is just a type mistake. this is not the problem...
when i click the button, nothing happens, the page refresh itself and thats all.....
thanks for your response....
Apr 09, 2012 07:23 PM|nirman.doshi|LINK
It seems you are rebinding your DataList in Page Load event.
Its ok to keep it there, but try putting that code in -
if (Page.IsPostBack == false)
--- move your rebind code here
Apr 09, 2012 08:08 PM|ellipertzov|LINK
you right, but this is not the problem.....right?
Apr 12, 2012 04:40 AM|Johnson-zhu|LINK
please check your code-behind of user control, it should like this:
protected void PlayButton_Click(object sender, ImageClickEventArgs e)
your parameter of the method is not currect.
Apr 13, 2012 02:36 PM|ellipertzov|LINK