edit datagrid with radiobuttonlist

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

How do you display a true/false field in a datagrid as a
radiobuttonlist? And how do you then edit it? I can do this easily
enough for textboxes and dropdownlists but I can't figure out how to do
it for radiobuttons.


Any advice would be really appreicated.


Cheers,

Mike
 
Why would you do that with a radiobuttonlist? I would just use a normal
checkbox for true/false conditions.

Grz, Kris.
 
I now have a check box on Edit, but I'm using this code in my Update
procedure to set a value to update my database with :

bool blnDNXLate = ((CheckBox)e.Item.FindControl("chkDNXLate")).Text;

And my syntax is obviously wrong as I cannot get it to work. Any ideas?


Thanks,

Mike
 
Sorry, just worked it out. I convert it to a string and insert into my
dbase as a string :

string strDNXLate = ((CheckBox)e.Item.FindControl("chkDNXLate")).Text;

Thanks,

Mike
 
Although for some reason whether I check the box or not, the value is
updated to 'False'. My code is :

<asp:TemplateColumn HeaderText="DNXLate">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "DNXLate") %>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox id="chkDNXLate" runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>

Update event:

string strDNXLate = ((CheckBox)e.Item.FindControl("chkDNXLate")).Text;

string strCallLogUpdate = "UPDATE CallType SET RSValue = " + strRSValue
+ ", DNXLate = '" + strDNXLate + "', DCUG = " + strDCUG + ", CallType =
" + strCallType + " WHERE Diallednum = '" + strDialledNum + "'";
 
Back
Top