Click here to Skip to main content
15,885,868 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All ,
I am binding a datalist in a button click event , and there are checkbox and image button inside datalist too .

1:-Button click event inside of datalist doesnot works
2:- also i am not able to get check box values of datalist .

Please help

Thanks
Raj
Posted
Comments
Homero Rivera 14-Jan-15 0:01am    
post the ASP code of the item you're clickindg on, also the C# code that's supposed to trigger on click. thank you.
Raj tilak Bose 14-Jan-15 0:26am    
this button is inside datalist
-----------------------------------------------------

protected void fn_Click(object sender, ImageClickEventArgs e)
{


foreach (DataListItem item in DataList2.Items) //PRINTER Categories
{
Label lbl = (Label)item.FindControl("Label1");
string id = lbl.Text;

string sss = "select * from tblManufacturerSubCategory where manufaturers_category_id='" + id + "' ";
ds = gs.getdata(sss);
if (ds.Tables[0].Rows.Count > 0)
{

DataList5.DataSource = ds;
DataList5.DataBind();


}
i++;
top1.Visible = true;
upper1.Visible = false;



}
}
Raj tilak Bose 14-Jan-15 0:28am    
POpulation Datalist image button is inside this datalist only
----------------------------------------------------------------------

protected void RadioButton3_CheckedChanged(object sender, EventArgs e)
{

maincategory.Visible = true;
maincategory2.Visible = false;

printersearch.Visible = true;
manufacturersearch.Visible = false;



string s = "select * from tblManufaturerCategory where manufaturers_category_id=1";
ds = gs.getdata(s);
if (ds.Tables[0].Rows.Count > 0)
{
DataList2.DataSource = ds;
DataList2.DataBind();
}

string s1 = "select * from tblManufaturerCategory where manufaturers_category_id=2";
ds = gs.getdata(s1);
if (ds.Tables[0].Rows.Count > 0)
{
DataList10.DataSource = ds;
DataList10.DataBind();
}

string s2 = "select * from tblManufaturerCategory where manufaturers_category_id=3";
ds = gs.getdata(s2);
if (ds.Tables[0].Rows.Count > 0)
{
DataList3.DataSource = ds;
DataList3.DataBind();
}

string s3 = "select * from tblManufaturerCategory where manufaturers_category_id=5";
ds = gs.getdata(s3);
if (ds.Tables[0].Rows.Count > 0)
{
DataList4.DataSource = ds;
DataList4.DataBind();
}


}
Suvendu Shekhar Giri 14-Jan-15 0:24am    
Unless you update your question with the relevant code, it's hard to tell you the solution.

1 solution

you can use this code for get check box values of datalist
foreach (DataListItem li in imageDatalistID.Items)
       {

           CheckBox cb = li.FindControl("chkbox_1") as CheckBox;


           if (cb != null)
           {
               if (cb.Checked)
               {
               // do your code here .
                   }
                   else
                   {

                   }
                   }
 
Share this answer
 

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