Hi folks, thanks to everyone's kind help, my little app is moving forward, and I'm back with another newbish question.
After much finagling with MapPath and so forth, I've written a sub that successfully writes data to my database when one of my radio voting buttons is clicked, yay!
Where I'm stuck now is this:
One of the values I want to insert into the database is stored in a boundfield in a grid view on the page. Specifically, on the page I am displaying this grid:
I want to insert whatever value is in the "SuggestionID" bound field as one of the values in my insert statement, which looks something like this:
Basically, I want to replace that hard-coded '1' in the SQL statement with the Suggestion ID.
The second value I want to insert ('10' in the code above) should actually be the value of whichever radio button was clicked to cause this sub to run, but I can't figure out how to do those two things.
The radio button list looks like this:
Thoughts?
Thanks!
Steve
After much finagling with MapPath and so forth, I've written a sub that successfully writes data to my database when one of my radio voting buttons is clicked, yay!
Where I'm stuck now is this:
One of the values I want to insert into the database is stored in a boundfield in a grid view on the page. Specifically, on the page I am displaying this grid:
Code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1">
<Columns>
<asp:BoundField DataField="SuggestionID" HeaderText="SuggestionID" InsertVisible="False"
SortExpression="SuggestionID" />
<asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:BoundField DataField="Suggestion" HeaderText="Suggestion" SortExpression="Suggestion" />
<asp:BoundField DataField="Suggester" HeaderText="Suggester" SortExpression="Suggester" />
<asp:HyperLinkField DataNavigateUrlFields="URL" DataTextField="URL" HeaderText="URL" target="_blank"/>
<asp:BoundField DataField="Priority" HeaderText="Priority" SortExpression="Priority" />
</Columns>
</asp:GridView>
I want to insert whatever value is in the "SuggestionID" bound field as one of the values in my insert statement, which looks something like this:
Code:
myCommand.CommandText = "insert into Votes(SuggestionID,VoteValue,IP) values('1','10','" & Request.UserHostAddress & "')"
Basically, I want to replace that hard-coded '1' in the SQL statement with the Suggestion ID.
The second value I want to insert ('10' in the code above) should actually be the value of whichever radio button was clicked to cause this sub to run, but I can't figure out how to do those two things.
The radio button list looks like this:
Code:
<asp:RadioButtonList ID="VoteList" runat="server" RepeatDirection="Horizontal" AutoPostBack="True" OnSelectedIndexChanged="VoteList_SelectedIndexChanged" BackColor="#E0E0E0" BorderColor="#404040" BorderStyle="Solid" BorderWidth="2px">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="6">6</asp:ListItem>
<asp:ListItem Value="7">7</asp:ListItem>
<asp:ListItem Value="8">8</asp:ListItem>
<asp:ListItem Value="9">9</asp:ListItem>
<asp:ListItem Value="10">10</asp:ListItem>
</asp:RadioButtonList>
Thoughts?
Thanks!
Steve