 |

|
Thank you Guys, the article has been interesting & I implement this procedure in a project ASP.
My regards.
/*Jfhdz
|
|
|
|

|
Don't ever try to add checkboxes to a DataGrid in a SharePoint web part!!! It is about as easy as building your own rocket and launching it to Mars.
I have a DataGrid (NOT a DataGridView) that is being populated with search results.
I am trying to add a column with a checkbox for each row. I need to be able to record which items were selected when a button is clicked, so I can do other processing.
EVERYTHING has to be rendered in C# obviously as it's in a web part, so i can't use asp.net tags....making this nearly impossible to figure out.
Any ideas?
|
|
|
|

|
When we add a customized checkbox column to a datagrid in .net (windows application) , the default property allows to check or uncheck the column using a double click. On the first click it selects the column and on the second click the column is either checked or unchecked.
To change this default property, we need to handle the click event on grid and modify the selected cell value. Here is the sample code to achieve this.
[C#.NET VS 2003 , Code to add checkbox column to grid using table style property]
dgItemDetails.TableStyles.Clear(); // clears the tablestyle (dgItemDetails is the name of grid)
DataGridTableStyle dgt = new DataGridTableStyle();
dgt.MappingName = "ItemDetails";
DataGridBoolColumn dgbCol = new DataGridBoolColumn(); // creates the checkbox column
dgbCol.MappingName = "Select";
dgbCol.HeaderText = "";
dgbCol.Width = 40;
dgbCol.AllowNull = false;
dgbCol.Alignment = HorizontalAlignment.Left;
dgt.GridColumnStyles.Add(dgbCol);
http://www.mindfiresolutions.com/Checkbox-Column-In-Datagrid-857.php[^]Cheers,
Eliza
|
|
|
|

|
I am using ASP.Net 2.0 and .Net 3.5, C# language.
I added a button field of type link. I want its visibility to be bound to a bool in the dataset. How can I do that?
|
|
|
|

|
hi Shaun,
i have a requirement where i need to restrict the user, not to select two check boxes in some case i am adding columns dynamically and on the cell click event i tried to loop thru all the other rows other than selected one and making them as read only
and when user tries to uncheck the selkected one all the other rows need to be editable(can check again any one of the check box)
after that i cant able to deselected the selected one.
ho can i acheve this?
and the grid i created using component class placing that component i am trying this.
|
|
|
|

|
Hi
What you are doing is definitely possible. Either callback (as you are doing) or client side javascript would be the way to go.
It sounds like you are on the right track just not sure where you have gone wrong.
Do you have a drop (location) of sample code I can look at that shows your problem.
Shaun
PS You may also find that you answer would be better answered in the programming forums as this question does not appear (as yet) to be directly related to the article i.e. is the problem with the CheckBoxColumn.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
sorry, i am not using asp but it is in windows based application
with best regards
|
|
|
|

|
This article is about checkboxes and datagrids in ASP.NET not winforms - I am assuming you are using .NET
I suggest you redirect your question to an appropriate codeproject forum i.e Windows Forms Discussions[^].
Though I may be able to help you - the question is not suitable for the discussion board related to this article.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerryBizSquawk
|
|
|
|

|
When i click on the check box and tick the particular file then the file has to be selected and then when i click on the upload button then the particular selected files have to be moved from the particular folder to the database in the form of XML.. So plz help me regarding this..
|
|
|
|

|
Sorry your question is not specific to this article and should be raised on the main programming forums instead.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hi ,
First of all , thank you for the files . This helped me in my project immensely.Been trying to find how to make the "Boolean Field (Editable)" column which displays the values "False" or "True" invisible. Below is my code.
CheckColumn checkCol = new CheckColumn(true);
checkCol.HeaderText = "Checked";
checkCol.DataField = "Checked";
checkCol.CheckedChanged += new EventHandler(checkCol_CheckedChanged);
dg.Columns.Add(checkCol);
Works beautifully , but the only problem is there is a checkbox and a text field.I want just the checkbox to be visible and not the text field.
Many Thanks
Shobha
|
|
|
|

|
Have you tried putting a blank string in the text field?
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
check box is not firing plz help me i am working on the project which required this option
|
|
|
|

|
In what way is not working? Have you read all the threads and have you hooked up the control properly?
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hello,
I hope someone can help me out. I'm having some problems with my checkbox not firing when I click on it. Here's my code:
protected void Page_Load(object sender, EventArgs e)
{
Label headerLabel = (Label)Master.FindControl("lblHeader");
headerLabel.Text = "IVEP Module";
ActiveDirectory ad = new ActiveDirectory();
string strFullUserName = Request.ServerVariables["LOGON_USER"].ToString();
string[] arrFullUserName = strFullUserName.Split('\\');
string strUser = arrFullUserName[1].ToString();
//Checks to see if the user logged in has permissions to this page.
ad.CheckGroups(strUser);
GetStudents();
}
public void Page_Init(object sender, EventArgs e)
{
//this.EnableViewState = false;
Add_Checkbox_Columns();
}
public void Add_Checkbox_Columns()
{
IVEP db = new IVEP();
dgIVEP.DataSource = CreateDataSource();
DataSet ds = db.IVEP_Grab_IVEP_Codes();
foreach (DataRow dr in ds.Tables[0].Rows)
{
CheckBoxColumn checkCol = new CheckBoxColumn(true);
checkCol.HeaderText = dr["ICTEP_Description"].ToString();
checkCol.DataField = "chk" + dr["ICTEPID"].ToString();
checkCol.ID = "chk" + dr["ICTEPID"].ToString();
checkCol.Initialize();
//checkCol.AutoPostBack = true;
checkCol.CheckedChanged += new EventHandler(this.OnCheckChanged);
dgIVEP.Columns.Add(checkCol);
}
}
//Gets all students by school, by course from SILK and displays their names and SNOs
public void GetStudents()
{
if (ddlSchools.SelectedValue.ToString() != " ")
{
if (ddlCourses.SelectedValue.ToString() != " ")
{
dgIVEP.DataSource = CreateDataSource();
dgIVEP.DataBind();
}
}
}
//Checks to see if the user has checked/unchecked a check box. If they have
//put the information for that student into the database by cid
private void OnCheckChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox) sender;
DataGrid dg = (DataGrid)chk.NamingContainer.NamingContainer;
DataGridItem container = (DataGridItem)chk.NamingContainer;
Label lblSno = (Label)container.Cells[0].FindControl("lblSno");
int iSno = Convert.ToInt32(lblSno.Text.ToString());
string strCID = ddlCourses.SelectedValue.ToString();
string strCheckBox = chk.ID.ToString();
string strRemoveChk = strCheckBox.TrimStart('c', 'h', 'k');
int iICTEPID = Convert.ToInt32(strRemoveChk);
int Checked = 0;
if (chk.Checked)
Checked = 1;
IVEP db = new IVEP();
db.IVEP_Insert_Into_ICTEP_Students(iSno, strCID, iICTEPID, Checked);
}
//Creates the datasource for dgIVEP
ICollection CreateDataSource()
{
DataTable dt1 = new DataTable();
int iSchoolNo = 0;
string strCID = "";
if (ddlSchools.SelectedValue.ToString() != " ")
{
iSchoolNo = Convert.ToInt32(ddlSchools.SelectedValue.ToString());
if (ddlCourses.SelectedValue.ToString() != " ")
{
strCID = ddlCourses.SelectedValue.ToString();
IVEP db = new IVEP();
//create the StudentFullName and Sno column to be returned in the dataset
dt1.Columns.Add("StudentFullName");
dt1.Columns.Add("Sno");
DataSet ds = db.IVEP_Grab_IVEP_Codes();
//Grab all the codes that have been put into the ICTEPCode table
foreach (DataRow dr in ds.Tables[0].Rows)
{
dt1.Columns.Add("chk" + dr["ICTEPID"].ToString());
}
ds = db.IVEP_Get_Students_By_SchoolNo_By_CID(iSchoolNo, strCID);
foreach (DataRow dr in ds.Tables[0].Rows)
{
dt1.Rows.Add(dr["StudentFullName"], dr["Sno"]);
}
}
}
DataView dv = new DataView(dt1);
return dv;
}
//Populates the checkboxes with data from ICTEPStudents
public void dgIVEP_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
int iSno = 0;
string strCID = ddlCourses.SelectedValue.ToString();
IVEP db = new IVEP();
//Grabs each datagrid row returned in by the datagrid
//iSno will always be the first cell in the datagrid.
//StudentFullName will be the second cell in the datagrid.
Label lblSno = (Label)e.Item.FindControl("lblSno");
iSno = Convert.ToInt32(lblSno.Text.ToString());
DataSet ds = db.IVEP_Get_ICTEPStudents(iSno, strCID);
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow row in ds.Tables[0].Rows)
{
string strCID_From_ICTEPStudents = row["CID"].ToString();
string strSno_From_ICTEPStudents = row["Sno"].ToString();
//checks to see if the current course returned by the database is the same
//as the course selected.
if (strCID == strCID_From_ICTEPStudents.Trim())
{
if (iSno.ToString() == strSno_From_ICTEPStudents.Trim())
{
string strICTEP_Description = row["ICTEP_Description"].ToString();
string strICTEPID = row["ICTEPID"].ToString();
CheckBox chk = (CheckBox)e.Item.FindControl("chk" + strICTEPID);
if (chk != null)
chk.Checked = true;
}
}
}
}
}
}
When I go to check the checkbox, the oncheckedchange event doesn't fire. Instead, the page just posts back and the check in the checkbox disappears. If I add the checkbox columns in the Page_Load event and page, the checkboxes for the student's on the next page are pre-checked. Any help would be greatly appreciated. Thanks!
Amber Loe
|
|
|
|

|
You need to add your checkbox column in the Page_Init, by time the Page_Load event fires it is too late and the system will not evaluate it.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hi Shaun,
Thanks for answering so quickly!
I did add the columns to the Page_Init event... Please take a look:
protected void Page_Init(object sender, EventArgs e)
{
IVEP db = new IVEP();
dgIVEP.DataSource = CreateDataSource();
DataSet ds = db.IVEP_Grab_IVEP_Codes();
foreach (DataRow dr in ds.Tables[0].Rows)
{
CheckBoxColumn checkCol = new CheckBoxColumn(true);
checkCol.CheckedChanged += new EventHandler(this.OnCheckChanged);
checkCol.HeaderText = dr["ICTEP_Description"].ToString();
// checkCol.DataField = "chk" + dr["ICTEPID"].ToString();
checkCol.ID = "chk" + dr["ICTEPID"].ToString();
dgIVEP.Columns.Add(checkCol);
}
}
I have to dynamically generate the columns based on the number of rows returned from my database. Right now, this peice of code will generate 5 different columns, as that's the number of rows I have in the table right now. But for some reason, even after adding it to the Page_Init, it's still not firing. Unless I'm doing something very wrong! Thanks for your help!
|
|
|
|

|
Hi... I figured out what was wrong in my code:
CORRECT:
protected void Page_Init(object sender, EventArgs e)
{
ObjectDataSource1.Select();
foreach (DataColumn field in _userrolestable.Columns)
{
if (field.ColumnName != "UserId" && field.ColumnName != "FullName")
{
//CheckBoxField col = new CheckBoxField();
CheckBoxColumn col = new CheckBoxColumn(true);
col.DataField = field.ColumnName;
col.HeaderText = field.ColumnName;
col.CheckedChanged += new EventHandler(this.OnCheckChanged);
GridView1.Columns.Add(col);
}
}
if (!Page.IsPostBack)
{
GridView1.DataSourceID = "ObjectDataSource1";
GridView1.DataBind();
}
}
WRONG:
protected void Page_Init(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ObjectDataSource1.Select();
foreach (DataColumn field in _userrolestable.Columns)
{
if (field.ColumnName != "UserId" && field.ColumnName != "FullName")
{
//CheckBoxField col = new CheckBoxField();
CheckBoxColumn col = new CheckBoxColumn(true);
col.DataField = field.ColumnName;
col.HeaderText = field.ColumnName;
col.CheckedChanged += new EventHandler(this.OnCheckChanged);
GridView1.Columns.Add(col);
}
}
GridView1.DataSourceID = "ObjectDataSource1";
GridView1.DataBind();
}
}
Yes... just the if (!Page.IsPostBack) was at the wrong place. Hope it helps!
|
|
|
|

|
Wow! Very interesting... but I need the postback because I have 2 dropdown lists that are passing values to a store procedure, which is what is populating my datagrid! Ahh, this control would be great if I could just figure it out!
|
|
|
|

|
I would do the data load in the Page_Load and not the Page_Init i.e. Page_Init is used to prepare the page and load controls and Page_Load to populate them - on a postback you can skip the loading by testing for the postback.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hi,
I have the control displayed and bound to a dataset field and it appropriately renders.
I am using this code twice to add 2 columns:
CheckBoxColumn bc = new CheckBoxColumn(true);
bc.DataField = "FIELD";
bc.HeaderText = "TITLE";
bc.CheckedChanged += new EventHandler(this.OnCheckChanged);
dg.Columns.Add(bc);
Basically a copy of the example code.
I have the callback function "OnCheckChanged" defined and have put a breakpoint in it but it appears to not be being called.
There is a postback occurring though when I check the box, since if I breakpoint in the PageLoad, it breaks but never steps into the event handler.
Any ideas what I can look at?
A Javascript example from the page is:
|
| XXXXXXXXX | XXXXXXXXXXX | Scott | <input id="DataGridRequirements__ctl3__ctl0" type="checkbox" name="DataGridRequirements:_ctl3:_ctl0" önclick="__doPostBack('DataGridRequirements$_ctl3$_ctl0','')" language="javascript" /> | <input id="DataGridRequirements__ctl3__ctl1" type="checkbox" name="DataGridRequirements:_ctl3:_ctl1" checked="checked" önclick="__doPostBack('DataGridRequirements$_ctl3$_ctl1','')" language="javascript" /> |
Thanks
|
|
|

|
Where do you set up the column? I set mine up in the Page_Init - that way the event is prepared before the PostBack event data is processed and callback events evaluated.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Currently I'm setting it up in Page_Load - because I thought that one was not supposed to setup controls in Page_Init, as there is no guarantee they've been created.
(e.g. http://www.peachpit.com/articles/article.asp?p=30182&rl=1)
I will try and see if I can get it to work that way though. Thank you
|
|
|
|

|
Just tried that and it works perfectly now.
Big thank you
|
|
|
|

|
Another quick question - do you know how to distinguish between 2 checkboxcolumns? I.e. my table has 2 columns that are checkboxes and when the event fires it just shows as being a CheckBox.
Obviously I could tie each column to a different Event Handler, but since the number of columns is dynamic, it would be nice if the event args showed the column index or something.
|
|
|
|

|
By changing the class and putting in a custom event handler delegate that passes out the DataField, I can do this now. Perhaps an improvement that should be put back in the original?
|
|
|
|

|
Perhaps - but it is such an old article and it's nice to see people solve these problems for themselves and contribut back via the forums rather than have it handed to them on a platter.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
I have to dynamically generate the columns based on the number of rows returned from my database. Right now, this peice of code will generate 5 different columns, as that's the number of rows I have in the table right now. But for some reason, even after adding it to the Page_Init, it's still not firing. Unless I'm doing something very wrong! Thanks for your help!
|
|
|
|

|
Hi,
How to use the Itemplate class and get the necessary methods? Can you please provide me the namespace name of the same?
Thanks,
Meeram395
|
|
|
|

|
Sorry,
I got the answer. I got it from the below part.
Thank you very much. Seems to be very nice and useful article
Meeram395
|
|
|
|

|
:-DI want to thank you a lot for this article. I'm programming a webpart for SharePoint 2003, and I had trouble for creating a checkbox column in my datagrid, since there's no design environment for webparts, and i didn't know how to translate the html to c# code.
Thaks a lot!
krausyd
Webmaster
-- modified at 11:00 Thursday 19th April, 2007
|
|
|
|

|
When i check the Checkbox in the Datagrid, the corresponding rows should be displayed in the next page and it should be READ-Only. Help me with the code ASAP....
|
|
|
|

|
Not sure how to help you?
Have you set AutoPostBack to true? Have put your displaying of corresponding rows in the handler?
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hi there,
I found it difficult to use DatagridItem.FindControl() function to find the internal checkbox item. So I added this code snippet into class CheckBoxItem
string _internalCheckBoxID = string.Empty;
public string InternalCheckBoxID
{
set
{
_internalCheckBoxID = value;
}
}
In order 4 this to work, you must add the following line in
CheckBoxItem.ITemplate.InstantiateIn(Control container)
box.ID = _internalCheckBoxID;
|
|
|
|

|
thankx for the tip
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
hi all
i have a datagrid which displays 5 columns, say productname,unitprice,quantity,tax,total
i got the result also, ie, values being displayed
but i want the quantity column to be editable, so that the user can edit to what he needs.
how can i modify my code so that only the quantity column is editable, and the remaining columns remain the same.
thanks in advance
|
|
|
|

|
Your question, since it is not related to the article, should be posted to the c# forums.
However, if you are only editing 1 row at a time then you can make the other fields readonly and so when you click edit on the field you wish to edit turns from a labl to an edit box and you can enter a new value.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hi
when i try to execute the code. i see this error message "Boolean is neither a DataColumn nor a DataRelation for table Table" (*my table name is Customers).
can you please answer me and thank you
|
|
|
|

|
I have solved the problem its so simple you have to change (checkCol.DataField = "Boolean";) the Boolean here to the Column name in your table which you want it to bind with your checkbox control
|
|
|
|

|
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
hi,
i added the autopostback and oncheckchange event, but it doesnt seem to work. when i click on the checkbox, it doesnt even post back to page_load.
the autopost back is set to true, and i added the specific event handler. i also added an onitemcommand in the aspx.
do you have any ideas?
|
|
|
|

|
is javascript enabled? - what does the javascript on the page look like?
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
hi shaun,
thanks for replying...
javscript is enabled, but i am sure its not a javascript problem...
this is the situation:
i have a datagrid, that for every row it MAY show a checkbox. when checkchanged, it should postback and perform the checkchanged event. the trick part is, i cant place the check box in the .aspx page directly because it is possible that not all the rows will show the checkbox based on certain conditions.
problem:
i created a class file (unarchivetemplate.cs) where it inherits the itemplate class. in the instanceof method, i instantiated the checkbox and set the valued for id, autopostback(true), checkchanged event, databinding event, checked.
when the page finishes loading and i click on a checkbox, it posts back, but it does not trigger the checkchanged method. it does nothing after the page_load method.
so i tried using ur way, by creating another class (unarchcolumn.cs) file that inherits templatecolumn for getting & setting the unarchivetemplate.cs i created earlier. i set the values (autopostback, checkchanged event, data field) of the unarchivetemplate.cs in the codebehind thru the unarchcolumn.cs.
however, after the page loads and i click on a checkbox, nothing happens. it doesnt even postback.
any suggetions? thanks shaun
|
|
|
|

|
quilla_b wrote: however, after the page loads and i click on a checkbox, nothing happens. it doesnt even postback.
If the page isn't doing the postback then it may be that the javascript has somehow got unhooked.
So you have a code sample you could post that shows the problem?
personally since it is only a checkbox I'd use the basic template column using the UI and add a checkbox such that you get one for each row. Then I'd hide the boxes I don't want by handling the ItemCreated or ItemDataBound event.
What I keep telling people is that this is a sample of how to make your own template column using a checkbox as a sample - I never expected people to trya and use it as-is when there are more simpler ways with such a simple control.
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
hey shaun,
i made an error somewhere, and it does postback now. hehe.. but it wasnt javascript.
anyway, im coding it behind html cuz the data in the rows im displaying is also using itemplate. now my prob is it wont raise the event. it posts back, but it wont raise the event somehow.
here's a snippet of my code:
myprofilessearchmore.aspx.cs
UnArchColumn tc2 = new UnArchColumn(true);
tc2.DataField = "Boolean";
tc2.CheckedChanged += new EventHandler(this.OnCheckChanged);
rptSearchResults.Columns.Add(tc2);
rptSearchResults.DataSource = pagedData;
rptSearchResults.DataBind();
unarchivetemplate.cs
public class UnArchiveTemplate:ITemplate
{
public event EventHandler CheckedChanged;
private string dataField;
private bool autoPostBack;
static int count = 0;
public UnArchiveTemplate()
{
}
public void InstantiateIn(System.Web.UI.Control container)
{
CheckBox chkbox = new CheckBox();
count ++;
chkbox.ID = "chkbox"+count;
chkbox.AutoPostBack = autoPostBack;
chkbox.CheckedChanged += new EventHandler(this.OnCheckChanged);
chkbox.DataBinding += new EventHandler(this.chkbox_DataBinding);
container.Controls.Add(chkbox);
}
private void chkbox_DataBinding (object sender, System.EventArgs e)
{
CheckBox chkbox = (CheckBox)sender;
if (chkbox.Checked == true)
chkbox.Checked = false;
else
chkbox.Checked = true;
}
private void OnCheckChanged(object sender, EventArgs e)
{
if (CheckedChanged != null)
{
CheckedChanged(sender, e);
}
}
public string DataField
{
get
{
return dataField;
}
set
{
dataField=value;
}
}
public bool AutoPostBack
{
set
{
autoPostBack = value;
}
get
{
return autoPostBack;
}
}
}
UnArchColumn.cs
public class UnArchColumn: TemplateColumn
{
UnArchiveTemplate unArchTemplate;
public UnArchColumn(bool ImmediatePostback)
{
unArchTemplate = new UnArchiveTemplate();
this.ItemTemplate = unArchTemplate as ITemplate;
AutoPostBack = ImmediatePostback;
}
public event EventHandler CheckedChanged
{
add
{
unArchTemplate.CheckedChanged += value;
}
remove
{
unArchTemplate.CheckedChanged -= value;
}
}
public bool AutoPostBack
{
set
{
unArchTemplate.AutoPostBack = value;
}
get
{
return unArchTemplate.AutoPostBack;
}
}
public string DataField
{
get
{
return unArchTemplate.DataField;
}
set
{
unArchTemplate.DataField = value;
unArchTemplate.DataField = value;
}
}
}
-- modified at 3:42 Monday 26th June, 2006
|
|
|
|

|
When do you add the column to the grid? - you need to make sure the column is there so the information in the postback will hook up properly - I have loaded mine in the Page_Init method
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
its alright shaun,
i just worked around the problem..
instead of forcing it to work, i just added an attribute to the control calling a function in the aspx.
then that aspx will activate a hidden control that when clicked will run an event server click. hehe.
thanks though.
|
|
|
|
|

|
Are you still having an issue - sorry dont' get to codeproject as often as I should nowadays
I'll be more enthusiastic about encouraging thinking outside the box when there's evidence of any thinking going on inside it. - pTerrywww.many-monkeys.com
|
|
|
|

|
Hi there,
I have looked on the exampled for CheckBox column to Datagrid. And I am quite blur with the explanation as Im still a beginner.
I am actually looking sample for adding checkBox column using VB code in ASPX.
And for your information I am using ASP.NET WebMatrix and using Access.
I have tried various ways and one of them is having a field "Availabe" and "Not Available" string written on dB instead of having checkBox in the first place. However when i perform some coding in updating the dB using this method, I have several compiling errors like
Line 47:
Line 48: Dim dBParam_available
Line 49: dBParam_available = 'No'
Line 50: ''As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
Line 51: dbParam_available.ParameterName = "@Available='No'"
Please advise or if you have any better solution to this implementation.
I am actually performing for checking out library books from the system. And I am trying to avoid using postback which the updated table will display again at lower bottom page.
Thanks in advance,
-Jason
|
|
|
|
 |