Show data from database in div tags using asp.net ajax updatepanel -
Show data from database in div tags using asp.net ajax updatepanel -
i creating online marketplace selling , purchasing physical products , online services. (combined olx type , freelancing website) using asp.net webforms. in content area of .aspx file, need show ads records database in form of divs within update panel tags.
<asp:scriptmanager id="scriptmanager2" runat="server"></asp:scriptmanager> <asp:updatepanel id="updatepanel2" runat="server"> <div> //here need append each image, title pair </div> </asp:updatepanel>
this aspx.cs page load function. @ end, i've created instance of class advertisement defined in c# class library project. using instance, m calling method of class,
protected void page_load(object sender, eventargs e) { string username = (string)session["username"]; if (session["username"] == null) { response.redirect("login.aspx"); } //if (session["username"] != null) else { string mylabeltext = this.session["username"].tostring(); user_username.innertext = mylabeltext; } advertisement objad = new ad(); objad.showads(); }
this ad.cs (class) code m creating connection db , using stored proc image path , title of ads database table named ad. need show each of these ads separate div on .aspx page. each div shall contain image , title of ad. using datareader object, how can display each record in form of separate div within update panel?
public void showads() { using (sqlconnection con = new sqlconnection(constring)) { sqlcommand cmd = new sqlcommand("spgetads", con); cmd.commandtype = system.data.commandtype.storedprocedure; con.open(); sqldatareader rdr = new sqldatareader(); rdr = cmd.executereader(); } }
asp.net ajax updatepanel
Comments
Post a Comment