You are on page 1of 7

<cc1:collectionpager id="collectionpager1" runat="server"

backnextdisplay="hyperlinks" backnextlocation="split" backtext="prev"


pagesize="10" pagenumbersseparator="&nbsp;" showfirstlast="false"
resultslocation="bottom" pagingmode="postback" slidersize="10" useslider="true"
labeltext="" nexttext="next" resultsformat=""
onclick="collectionpager1_click"></cc1:collectionpager>

</div></td>
<td width="33%" bgcolor="#ffffff" class="bluetext10"><div
align="right"><div id="upper" runat="server"></div></div></td>
</tr>
</table>
</div>
</div></td>
</tr>
<tr class="spacer3">
<td valign="top">&nbsp;</td>
</tr>
<tr>
<td valign="top">
<asp:repeater id="replanguage" runat="server"
onitemdatabound="replanguage_itemdatabound"
onitemcommand="replanguage_itemcommand">
<headertemplate><table width="100%" border="0" cellspacing="0"
cellpadding="1">
<tr class="bgcolorblue">
<td width="8%" height="20"><asp:checkbox id="chkallhead"
runat="server"
onclick="checkalldatagridcheckboxes('ctl00_maincontentplaceholder_replanguage_ctl0
1_chkmember',document.forms[0].ctl00_maincontentplaceholder_replanguage_ctl00_chka
llhead.checked)"/></td>
<td width="25%">vocabulary items<img src="images/arrowdown.gif"
alt="" width="10" height="8"></td>
<td width="25%">meaning</td>
<td width="4%">&nbsp;</td>
<td width="18%">part of speech<img src="images/arrowdown.gif"
alt="" width="10" height="8"></td>
<td width="10%"><img src="images/active.gif" alt="" width="16"
height="15"><img src="images/arrowdown.gif" alt="" width="10" height="8"></td>
<td width="15%">user id<img src="images/arrowdown.gif" alt=""
width="10" height="8"></td>
</tr>
</headertemplate>
<itemtemplate>
<tr>
<td width="8%" align="center">
<div align="center">
<asp:checkbox id="chkmember" runat="server" />
</div>
</td>
<td width="25%" height="55" class="textblack"><div
align="center"><asp:label id="lblvocitems" runat="server" text='<%#
bind("strword") %>'></asp:label> </div></td>
<td width="25%" class="textblack"><asp:label
id="lblmeaning" runat="server" text='<%# bind("strlongmeaning")
%>'></asp:label></td>
<td width="4%" class="textblack"><div
align="center"><asp:imagebutton id="btnattach" runat="server"
imageurl="~/images/attach.jpg" alt="" width="10" height="22" /> </div></td>
<td width="18%" class="textblack-bold"><asp:label
id="lblpartofspeech" runat="server" text='<%# bind("strpartofspeech")
%>'></asp:label></td>
<td width="10%"><div align="center"><asp:imagebutton
id="btnactive" runat="server" visible="false" imageurl="~/images/active_light.gif"
commandname="deactive" alt="" width="16" height="15" /><asp:imagebutton
id="btninactive" runat="server" visible="false"
imageurl="~/images/unactive_white.gif" commandname="active" alt="" width="16"
height="15" /></div></td>
<td width="15%"><div align="center"><asp:imagebutton
id="btnimage" runat="server" imageurl="~/images/image.jpg" alt="" width="35"
height="35" border="0" class="image_border" /><br><asp:linkbutton id="btnname"
runat="server" cssclass="verdana9"></asp:linkbutton><asp:hiddenfield id="hidid"
runat="server" value='<%# bind("iid") %>' /><asp:hiddenfield id="hidmemberid"
runat="server" value='<%# bind("imemberid") %>' /></div></td>
</tr>
<tr>
<td colspan="7" class="lightbgwithtext">
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="3%">&nbsp;</td>
<td width="47%"><a href="#"
class="blue_link1">more info</a> &nbsp;|&nbsp; <a href="#"
class="blue_link1">read/post comments</a> &nbsp;|&nbsp; <a href="#"
class="red_link">report abuse/error</a> &nbsp;|&nbsp; <a href="#"
class="blue_link1"></a></td>
<td width="51%"><img src="images/star.gif"
alt="" width="63" height="15"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="7">
<asp:literal id="litad" runat="server" visible="false"
text="<table width='100%'><tr class='spacer3'><td>&nbsp;</td></tr><tr><td
class='googleadv2'>&nbsp;</td></tr><tr
class='spacer3'><td>&nbsp;</td></tr></table>"></asp:literal>
</td>
</tr>

</itemtemplate>
<footertemplate>
</table>
</footertemplate>
</asp:repeater>
</td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="33%" bgcolor="#ffffff" class="bluetext"><div
align="left"><strong>&nbsp;&nbsp;
&nbsp;
<asp:checkbox id="chkallfooter" runat="server"
onclick="checkalldatagridcheckboxes11('ctl00_maincontentplaceholder_replanguage_ct
l01_chkmember',document.forms[0].ctl00_maincontentplaceholder_chkallfooter.checked
)" />
</strong></div></td>
<td width="34%" bgcolor="#ffffff" class="bluetext"><div
align="center"> </div></td>
<td width="33%" bgcolor="#ffffff" class="bluetext10"><div
align="right"><div id="bottom" runat="server"></div></div></td>
</tr>
</table></td>

==================================================================================
=====

//fn_binddata();
bindcollectionpager();

if (!ispostback)
{
bindreplanguage();
}
=================================================
private void bindcollectionpager()
{
try
{
languagemaster objlm = new languagemaster();
coreweblist<languagemaster> listmemberlanguage =
objlm.fn_getlanguagemasterforpublic();
inttotalcount = listmemberlanguage.count;
collectionpager1.datasource = listmemberlanguage;
collectionpager1.bindtocontrol = replanguage;
collectionpager1.firstpageholderid = upper.uniqueid;
collectionpager1.secondpageholderid = bottom.uniqueid;
collectionpager1.databind();
}
catch (exception ex)
{
response.write(ex.message);
}
}

private void bindreplanguage()


{
try
{
replanguage.datasource = collectionpager1.datasourcepaged;
replanguage.databind();
}
catch (exception ex)
{
//lmssg.text = "error : " + ex.message;
//lmssg.visible = true;
}
}

protected void replanguage_itemdatabound(object sender, repeateritemeventargs e)


{
try
{
if (e.item.itemtype == listitemtype.item || e.item.itemtype ==
listitemtype.alternatingitem)
{
int cont = e.item.itemindex + 1;

//for advertisement, after 5 records


if (cont % 5 == 0)
{
literal litadd = e.item.findcontrol("litad") as literal;
litadd.visible = true;
}
else
{
literal litadd = e.item.findcontrol("litad") as literal;
litadd.visible = false;
}

if (cont % 10 == 0)
{
literal litadd = e.item.findcontrol("litad") as literal;
litadd.visible = false;
}

if (collectionpager1.currentpage == collectionpager1.pagecount)
{
intcount = inttotalcount % 10;
if (cont < 5)
{
if (cont == intcount)
{
literal litadd = e.item.findcontrol("litad") as
literal;
litadd.visible = true;
}
}
}

//binding photo and member name


hiddenfield hidmember = e.item.findcontrol("hidmemberid") as
hiddenfield;
if (hidmember != null)
{
//for member name
linkbutton btnname = e.item.findcontrol("btnname") as
linkbutton;
membermasterclass objmm = new membermasterclass();
objmm.iid = int.parse(hidmember.value);
objmm = objmm.fn_getmemberbyid();
if (objmm != null)
{
btnname.text = objmm.strfirstname;
}

//for member photo


imagebutton btnimage = e.item.findcontrol("btnimage") as
imagebutton;
profilephotosclass objpp = new profilephotosclass();
coreweblist<profilephotosclass> objpplist = new
coreweblist<profilephotosclass>();
objpp.imemberid = int.parse(hidmember.value);
objpp.booldefault = true;
objpplist = objpp.fn_getdefaultimagebymemberid();
if (objpplist != null)
{
if (objpplist.count != 0)
{
datatable dt = (datatable)objpplist;
string strphotopath =
system.configuration.configurationmanager.appsettings["profile_thumbnailimage_path
"].tostring();
btnimage.imageurl = strphotopath +
dt.rows[0]["strfilename"].tostring();
}
}

//for favourite member


imagebutton btnactive = e.item.findcontrol("btnactive") as
imagebutton;
imagebutton btninactive = e.item.findcontrol("btninactive") as
imagebutton;
memberfavouriteclass objmf = new memberfavouriteclass();
coreweblist<memberfavouriteclass> objmflist = new
coreweblist<memberfavouriteclass>();
objmf.ifavouritememberid = int.parse(hidmember.value);
objmf.imemberid = int.parse(session["id"].tostring());
objmflist = objmf.fn_getmemberfavourite();
if (objmflist != null)
{
if (objmflist.count != 0)
{
btnactive.visible = true;
btninactive.visible = false;
}
else
{
btnactive.visible = false;
btninactive.visible = true;
}
}
else
{
btnactive.visible = false;
btninactive.visible = true;
}
}
}
}
catch (exception ex)
{
//lmssg.text = "error : " + ex.message;
//lmssg.visible = true;
}
}

protected void replanguage_itemcommand(object source, repeatercommandeventargs


e)
{
try
{
hiddenfield hidfavouritememberid = e.item.findcontrol("hidmemberid")
as hiddenfield;

//add in favourite list


if (e.commandname == "active")
{
memberfavouriteclass objmf = new memberfavouriteclass();

objmf.ifavouritememberid = int.parse(hidfavouritememberid.value);
objmf.imemberid = int.parse(session["id"].tostring());
string strresponse = objmf.fn_creatememberfavourite();
if (strresponse == "success")
{
bindreplanguage();
}
else
{

}
}

//remove from favourite list


if (e.commandname == "deactive")
{
memberfavouriteclass objmf = new memberfavouriteclass();
objmf.ifavouritememberid = int.parse(hidfavouritememberid.value);
objmf.imemberid = int.parse(session["id"].tostring());
string strresponse = objmf.fn_deletememberfavourite();
if (strresponse == "success")
{
bindreplanguage();
}
else
{

}
}
}
catch (exception ex)
{
//lmssg.text = "error : " + ex.message;
//lmssg.visible = true;
}
}
protected void collectionpager1_click(object sender, eventargs e)
{
bindreplanguage();
}
}

////// \\10.0.0.100\developers\d4d

You might also like