edit datagrid with radiobuttonlist

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
 
K

Kris van der Mast

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

Grz, Kris.
 
M

Mike P

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
 
M

Mike P

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
 
M

Mike P

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 + "'";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top