There are similar questions to mine, but none in the specific context. Process that is supposed to happen. A user selects a command from a dropdown list and than a HTTPGet request is then sent and response stored.
A specific command is "getvizwordcloud-people" in which the desired output should like this:
The aspx code looks like this:
<div>
<asp:Label ID="lblSelectAnalysis" runat="server" Text="SelectAnalysis"></asp:Label>
<asp:DropDownList ID="ddlSAList" runat="server"></asp:DropDownList>
<asp:Label ID="lblRequests" runat="server" Text="Choose Request:"></asp:Label>
<asp:DropDownList ID="ddlRequest" runat="server">
<asp:ListItem Text="getvisnarrativeweb"></asp:ListItem>
<asp:ListItem Text="getviswordcloud-subjects"></asp:ListItem>
<asp:ListItem Text="getviswordcloud-places"></asp:ListItem>
<asp:ListItem Text="getviswordcloud-people"></asp:ListItem>
<asp:ListItem Text="getviswordcloud-groups"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnMakeRequest" runat="server" Text="Button" OnClick="btnMakeRequest_Click" />
</div>
<div runat="server" id="displayViz"></div>
The DisplayViz div is the key component in this.
The Code Behind looks like this:
protected void btnMakeRequest_Click(object sender, EventArgs e)
{
String URL = "http://saworker.storyanalyzer.org/saresults.php?"
+ ddlSAList.SelectedValue.ToString()
+ "&request="
+ ddlRequest.SelectedItem.ToString();
// Issue the GET command to the SA Server and get the response.
var response = hClient.GetStringAsync(new Uri(URL)).Result;
// The response could be plain text for some API commands
// or it could be HTML (to show a visualization)
if (ddlRequest.SelectedIndex >= 0 && ddlRequest.SelectedIndex <= 3)
{
// The result is plain text: A URL for the source for example or story title.
txtDisplay.Text = response;
}
else if (ddlRequest.SelectedItem.ToString().Equals("showbootstrapdashboard"))
{
// Here the user has selected to show the bootstrap dashboard.
// We will open the URL for the dashboard in a new tab.
Page.ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('" + URL + "','_newtab');", true);
//Response.Redirect(URL);
}
else
{
// The results are HRML for a visualization. I'll replace the contents
// of a DIV on the ASP.net form with the results
// This will dynamically update the HTML page.
displayViz.InnerHtml = response;
}
}
While this works in this separate project, it does not work in the project that I really want to use. In my project I use the same exact code. The difference is that I am using a master page structure to the application and I am using bootstrap to add design features. I know that is has nothing to do with web form being a master content page (because this code is also is also a master content page). I believe the problem has to do with the bootstrap I am using.
In my application the div tag will expand, showing a response, but nothing will show. It is just a blank screen. There are many things that I have tried to resolve this issue. I have made it so when a user requests this specific request, I redirect them to a different page (That is not a content page nor uses any bootstrap) and it produced the same result. The div tag would expand but nothing would show.
If you have any ideas as to why this happening. Specifically why bootstrap would be causing this happen.
Thank you
Im not sure if this will help, but this is what the returned response contains:
<div id="peopleContainer" class="container" style="width:500px; height:300px"></div><script src="http://saworker.storyanalyzer.org/jquery-2.2.3.js"></script><script src="http://d3js.org/d3.v3.min.js"></script><script src="http://saworker.storyanalyzer.org/d3/d3.layout.cloud.js"></script> <script src="http://saworker.storyanalyzer.org/d3cloudinterface.js"></script> <script type="text/javascript">var peopleContainer_words = [{text: 'Quarterback Aaron Rodgers-12-1', weight: '0.3669772256728778', vsoIdx: '-1', color: '#000000', link: {href: '#', test: 'testing'}},{text: 'Joe Rogan-10-8', weight: '0.16847826086956522', vsoIdx: '-1', color: '#000000', link: {href: '#', test: 'testing'}},{text: 'Jimmy Kimmel-10-2', weight: '0.17261904761904762', vsoIdx: '-1', color: '#000000', link: {href: '#', test: 'testing'}},{text: 'host Howard Stern-5-2', weight: '0.3669772256728778', vsoIdx: '-1', color: '#000000', link: {href: '#', test: 'testing'}}];var peopleContainerCloud = new d3CloudInterface(peopleContainer_words, 'peopleContainer');</script>