|
|
|
start date: Mon, 20 Aug 2007 14:34:09 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
unknown
|
|
2
mike
|
unbound controls in GridView
Hi,
I got a grid control, i bind it to a datatable, but it has some extra
fields, with textboxes, checkboxes, dropdowns etc (in a template
field) that are not bound. they are not auto-postback either. user
changes values in them, then clicks submit. anybody knows how i can
get the values in those controls, per each record? (ideally, i could
know which record's controls have been updated and get only to them.
then i have my own code to deal with those new values)
thanks
Date:Mon, 20 Aug 2007 14:34:09 -0700
Author:
|
Re: unbound controls in GridView
I do something similar with my GridViews. In view mode, I just have a
representaton of the value. When I switch to Edit mode is when I want
to show my checkboxes and such.
To get values out of them you need to handle the GridView.RowUpdating
event. The code below (my GridView.RowUpdating event) finds the
txtCareerHi control in the selected GridView row and mirrors it in a
TextBox control stored in memory. On my form, the TextBox is a multi-
line TextBox and I want to preserve the vbCrLf characters. The funny
thing is that in view mode, I need to render them as HTML "<br />"
tags while in the TextBox, I need vbCrLf. I store the <br /> tags in
my database.
' converts vbCrLf to <br /> tag for browser display. The <br /
> tags are stored in the database
Dim career As TextBox
career =
CType(gridCareer.Rows(e.RowIndex).FindControl("txtCareerHi"), TextBox)
Dim strCareer As String
strCareer = career.Text.Replace(vbCrLf, "<br />")
e.NewValues.Add("career_hi", strCareer)
gridCareer.DataBind()
My problem is that the values I want for my RadioButtonLists and
DropDownLists are stored in my database. I need a value and text. How
can I bind the RadioButtonList with value and text properties? They
only exist when the row enters Edit mode.
Cheers
Mike
Date:Mon, 20 Aug 2007 17:08:15 -0700
Author:
|
|
|