Here's a picture of the gridview I'm working with: https://i.sstatic.net/Ce5gG.png
Here's my issue: I have a DropDownList (not shown in the picture) that has the same number of items as the Fraction DropDownList (shown in image). Each of the indices match with each other (ex: index 4 of the other field is the same as index 4 of the Fraction DropDownList), so when submitting the form, they have to have both of these match properly.
What I want to do is check and see if they do indeed match. I've tried:
this.gvRecords.Rows[0].Cells[2].Text
&
(((DropDownList)this.gvReserveRecords.Controls[0].Controls[0]
.FindControl("gvcbnFraction")).SelectedIndex
Neither have worked. They are just returning an empty string.
Here's some info that might help:
I am using ASP.NET Web Forms
The GridView is initially empty, but once the information is filled in, the 'Insert' LinkButton is clicked and the data is added to a database, and the GridView then calls DataBind().
I'm trying to compare the value of Fraction to a field outside of the GridView, if that matters at all.
Let me know if you need any other information!
<asp:DropDownList ID="gvcbnFraction" runat="server" Width="75px"> <asp:ListItem>FLOAT</asp:ListItem> <asp:ListItem>1/8</asp:ListItem> ...</asp:DropDownList>That's how it looks on the ascx page, however, I can't use it in my codebehind file for some reason. It tells me that it's not available in the current context.