I Am fresher to .Net, I have a doubt that, in my website i have to display the no.of people clicking on the like image for the conversation!!!!. I used repeater to display the conversation. Plzzz anyone Helpme.... Here Im attaching my code and stored procedure.
Source View:
Comments | |||
| |||
| |||
CodeView:
protected void RepDetails_ItemCommand(object source, RepeaterCommandEventArgs e)
{
ImageButton imglike = sender as ImageButton;
Repeater RepDetail1 = (Repeater)imglike.NamingContainer;
Label lbllike = (Label)RepDetail1.FindControl("lblcount");
lblcount = lbllike.Text;
try
{
con.Open();
SqlCommand cmd = new SqlCommand("usp_likecount", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.AddWithValue("@EventID", lblID.Text);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
RepDetails.DataSource = ds;
RepDetails.DataBind();
}
Stored Procedure:
USE [*****]
GO
/****** Object: StoredProcedure [dbo].[usp_likecount] Script Date: 02/24/2014 11:38:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[usp_likecount]
(@EventID int
,@EvenConvID int)
AS
BEGIN
DECLARE @like int
SELECT @like=Likes FROM EventConv WHERE EventID=@EventID AND EvenConvID=@EvenConvID
UPDATE EventConv SET [Likes]=@like+1 WHERE EvenConvID=@EvenConvID
END
Sai Prasad AnumoluPosted Mar 3, 2014, 2:19 AM
HimaPosted Feb 24, 2014, 8:21 AM
Posted Feb 24, 2014, 7:40 AM
count = Convert.ToInt32( lbllike.Text);
HimaPosted Feb 24, 2014, 7:37 AM
Posted Feb 24, 2014, 7:27 AM
But, you're not passing Count variable to the stored procedure. Are you using in some other places?
HimaPosted Feb 24, 2014, 5:13 AM
PLz Have a look,
Lakshmanan Sethu SankaranarayanPosted Feb 24, 2014, 4:59 AM
HimaPosted Feb 24, 2014, 4:56 AM
But now im getting this error,
Here count is integer..
'string' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'string' could be found
Line 70: //Repeater RepDetail1 = (Repeater)imglike.NamingContainer; Line 71: Label lbllike = (Label)RepDetails.FindControl("lblcount"); Line 72: lblcount.Text = lbllike.Text; Line 73: try Line 74: {
Lakshmanan Sethu SankaranarayanPosted Feb 24, 2014, 4:54 AM
HimaPosted Feb 24, 2014, 4:50 AM
Thanks&Regards
Lakshmanan Sethu SankaranarayanPosted Feb 24, 2014, 4:45 AM
HimaPosted Feb 24, 2014, 4:19 AM
This is the line I am getting Error
Lakshmanan Sethu SankaranarayanPosted Feb 24, 2014, 4:17 AM
Please let us know the statement which gives you error?
HimaPosted Feb 24, 2014, 4:16 AM
Posted Feb 24, 2014, 4:14 AM
HimaPosted Feb 24, 2014, 4:11 AM
Posted Feb 24, 2014, 4:07 AM
HimaPosted Feb 24, 2014, 4:05 AM
Posted Feb 24, 2014, 4:01 AM
HimaPosted Feb 24, 2014, 3:01 AM
thanks&Regards.
Posted Feb 24, 2014, 1:42 AM
Are you getting any error?
Thanks
Murali