Click here to Skip to main content
15,889,863 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
i have try google but can't get a proper solution yet. I want set a value on Div in Datalist help of jquery. Because i want value get and save in database without page postback. I have try many way but can't success. i try add cssclass value find but all cssclass value find. like that our datalist have three record's
like that
1 . job_id 11
2 . job_id 12
3 . job_id 13

suppose I click the job_id 11 then change the value only 11 not a 12 or 13 record's.

some code mention below.
ASP.NET
<asp:ImageButton ID="Img_Up_vote" runat="server" OnClientClick="upvote(this);return false;"
                                        ImageUrl="~/images/up.png" data-JobID='<%#Eval("OrgJob_id")%>' />
                                </a>
                                <br />
                                <div id="vote_score">
                                    <%#Eval("VoteCount")%></div> //Change the Data here
                                <br />


plz some body help me ...thanks in Advance.
Posted
Comments
Can you post the rendered HTML of page? Paste only the rendered DataList HTML.
joginder-banger 7-Mar-14 6:08am    
Gud Evening sir...off course i post plz wait bit of time.
joginder-banger 7-Mar-14 6:10am    
<input type="image" name="ctl00$ctl00$ContentPlaceHolder1$List$ctl00$Img_Up_vote" id="ContentPlaceHolder1_List_Img_Up_vote_0" data-JobID="11" src="../images/up.png" önclick="upvote(this);return false;" />

<br />
<div id="vote_score"> //sir on this div i want change data
</div>
<br />

<input type="image" name="ctl00$ctl00$ContentPlaceHolder1$List$ctl00$Img_Vote_Down" id="ContentPlaceHolder1_List_Img_Vote_Down_0" src="../images/up2.png" />
No I need the whole DataList HTML and always hit Reply and add a comment so that I will be notified.
joginder-banger 8-Mar-14 6:17am    
sir i have no data list at this time. i will provide Monday complete datalist today is holiday.

1 solution

Okay, first give one attribute to your div first, i.e runat="server".
Like this :
XML
<div ID="div1" runat="server">
<%#Eval("YourColumName")%>
</div> 


So finally, your code would be :
ASP.NET
<asp:imagebutton id="Img_Up_vote" runat="server" onclientclick="upvote(this);return false;" xmlns:asp="#unknown">
                                        ImageUrl="~/images/up.png" data-JobID='<%#Eval("OrgJob_id")%>' />
                                
                                <br />
                                <div id="vote_score"  runat="server">
                                    <%#Eval("VoteCount")%></div>
                                <br /></asp:imagebutton>

-KR
 
Share this answer
 
v2
Comments
joginder-banger 8-Mar-14 6:21am    
thanks for reply sir actually i try set a value help of jquery. Suppose we have three records get after searching record's then how can set a second number div value.
joginder-banger 8-Mar-14 6:33am    
so why used the Runat="server" in this div.
Krunal Rohit 8-Mar-14 10:07am    
Don't have any idea about JQuery.

-KR
joginder-banger 9-Mar-14 8:48am    
ok
Krunal Rohit 9-Mar-14 8:53am    
If this answer has solved your problem then, click on "Accept Solution". That will help other user who's be having same problem. :)

-KR

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900