TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
bob white
NA
13
99.9k
how to capture master page content controls via Linq
Jan 6 2011 5:12 PM
Hi, I have not worked with Linq, but I need to fix this piece of code. It turns out that the code above does not capture the input or div controls !
Here is the code, the problem is that the inputControls.Count is always Zero and cannot execture any further code.
my question how can I fix the fir two list code?
and I do not know why this.Page.Form.Controls[11].Controls // the index of 11 means
List<Control> inputControls = ( from Control c in this.Page.Form.Controls[11].Controls
where c.GetType() == typeof(TextBox)
select c ).ToList();
List<Control> divControls = ( from Control c in this.Page.Form.Controls[11].Controls
where c.GetType() == typeof( HtmlGenericControl ) &&
( (HtmlGenericControl)c ).TagName == "div"
select c ).ToList();
if ( inputControls.Count > 0 )
this is some code from the GUI interface
I have about 20 fields that they all have same format as this
<tr>
<td><label>Positive MAT</label></td>
<td><asp:TextBox runat="server" id="txtFAPositiveMAT" /></td>
<td><div id="FAPositiveMAT" runat="server" /></td>
<td><pre></pre></td>
</tr>
any help is appreciated.
Bob
Reply
Answers (
1
)
Linq to sql.. how to retrive the name field from table using linq
update database via linq by iterating formcontrols ?