Last post Aug 15, 2014 02:57 PM by Oliphant
Aug 11, 2014 04:39 PM|Oliphant|LINK
For some reason I cannot get the following simple query to work. I’ve used variations of this query before, so I must be missing something really stupid this time.
On an .aspx page (below), I want the user to click on BtnBegin, which fires off the SQL query on the aspx.cs page. The query calls a local SQLExpress table and returns a single value.
Thanks for any help. This can get really frustrating.
<asp:Label CssClass="VerbField" ID="SelectedVerb" runat="server" Visible="false" Text=""></asp:Label>
<asp:Button CssClass="btnBegin" ID="BtnBegin" runat="server" OnClick="BtnBegin_Click" Text="Click to Begin" />
public partial class ConjDrill : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected string strVerbCode;
protected void BtnBegin_Click(object sender, EventArgs e)
SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["ERConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand("SELECT TOP 1 Verb FROM verbtest ORDER BY NEWID()", conn);
SqlDataReader rdr = cmd.ExecuteReader();
SelectedVerb.Text = rdr["Verb"].ToString();
SelectedVerb.Visible = true;
BtnBegin.Text = "Next";
Aug 11, 2014 04:50 PM|MetalAsp.Net|LINK
Put a breakpoint in the click handler and step through your code. Does it flow through as you expect?
Aug 12, 2014 09:56 AM|Oliphant|LINK
I think I’ve discovered the real problem, which stumps this beginner. Alone, theBtnBegin_Click call to SQL works just fine. But the real problem seems to be that, except for the asp:Label and asp:Button, everything else on the page is drawn using js Raphael.
I was advised to do this because I needed a lot of clickable polygons on my page.
Sorry to be so vague in my question, but how all these components interact is unclear. Any good tutorials or discussions would be much appreciated.
Aug 13, 2014 04:56 AM|George Hua - MSFT|LINK
Here are some articles for your reference:
Injecting Client-Side Script from an ASP.NET Server Control
Working with Client-Side Script
Aug 15, 2014 02:57 PM|Oliphant|LINK
Yes, that's what I need to do. Thanks for all the articles.