I want to define a method that take an integer as input and creates dynamically a list of all descending integer numbers to zero. I find trouble into calling method for the n-1 element
For some reason, all of the objects in my ASP.NET markup are now null when I try to assign values to their properties in the code behind.
My project was going fine and then now when I try to assign a data source to a GridView, I get a null reference error.
I have no idea why it's doing this. I am not doing nothing special. I am just trying to assign a value to a property to an asp.net element in on the page. The intellisense knows that the element is there and I get no errors when I build the project. It's just when I am running the website I get the null reference.
I have been trying to fix this issue for a couple weeks now. Please Help.
Thanks.
Here is the code:
protected void Page_PreRender(object sender, EventArgs e)
{
LoadData();
}
private void LoadData()
{
Entities context = new Entities();
var types = (from t in context.CustomerTypes
select t).OrderBy(t => t.TypeName);
gvCustomerTypes.DataSource = types;
gvCustomerTypes.DataBind();
}
and on in the markup the gridview looks like this:
<asp:GridView ID="gvCustomerTypes" runat="server" ShowHeader="true" GridLines="Both"
AutoGenerateColumns="false" AlternatingRowStyle-BackColor="AliceBlue" Width="100%">
<Columns>
<asp:TemplateField HeaderText="Customer Type Name" HeaderStyle-HorizontalAlign="Left"
ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblType" runat="server" Text='<%# Eval("TypeName") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" NavigateUrl='<%#Eval("CustomerTypeID", "CreateEditCustomerType.aspx?ID={0}") %>'
Text="Edit" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" CommandName='<%#Eval("CustomerTypeID") %>' OnClientClick="javascript:return confirm('Are you sure you want to delete this Customer Type?');"
OnCommand="DeleteCustomerType" Text="Delete" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I have a hierarchy with links nested in list element like this:
<ul>
<li><a href="#">Page 1</a>
<ul>
<li><a href="#">Page 1.1</a></li>
<li><a href="#">Page 1.2</a>
<ul>
<li><a href="#">Page 1.2.1</a></li>
<li><a href="#">Page 1.2.2</a></li>
</ul>
</li>
<li><a href="#">Page 1.3</a></li>
</ul>
</li>
<li><a href="#">Page 2</a>
<ul>
<li><a href="#">Page 2.1</a></li>
<li><a href="#">Page 2.2</a></li>
</ul>
</li>
<li><a href="#">Page 3</a>
<ul>
<li><a href="#">Page 3.1</a>
<ul>
<li><a href="#">Page 3.1.1</a></li>
<li><a href="#">Page 3.1.2</a></li>
</ul>
<li><a href="#">Page 3.2</a></li>
<li><a href="#">Page 3.3</a></li>
<ul>
<li><a href="#">Page 3.1.1</a></li>
<li><a href="#">Page 3.1.2</a></li>
</ul>
</li>
</ul>
</li>
</ul>
Basically just a sitemap. But I want to make next and previous links with jQuery, which finds the active page you're on (probably by checking for a class), and finding the previous and next anchor element (taking no regards of the hierarchy). I've tried with next(), previous() and find() but can't seem to get it to work.
What is the easiest way to get the anchor elements before and after the current one?
A z buffer is just a 3d array that shows what object should be written in front of another object. each element in the array represents a pixel that holds a value from 0.0 to 1.0. My question is if that is all a z buffer does, then why are some buffers 24bit, 32bit, and 16 bit ??
Is it possible to simulate a click on a webpage using javascript but without defining a specific element, but rather just specifying the document?
I would have liked to do something like this, and if the location happens to have a link, then this will be pressed:
function simulateClick(x, y)
{
var evt = window.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
x, y, x, y, 1, false, false, false, false, 0, null);
window.dispatchEvent(evt);
}
First time using "JSON" and I've just been working away at my dissertation and I'm integrating a few features from the steam API.. now I'm a little bit confused as to how to create arrays.
function test_steamAPI()
{
$api = ('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key='.get_Steam_api().'&steamids=76561197960435530');
$test = decode_url($api);
var_dump($test['response']['players'][0]['personaname']['steamid']);
}
//Function to decode and return the data.
function decode_url($url)
{
$decodeURL = $url;
$data = file_get_contents($url);
$data_output = json_decode($data, true);
return $data_output;
}
So ea I've wrote a simple method to decode Json as I'll be doing a fair bit..
But just wondering the best way to print out arrays..
I can't for the life of me get it to print more than 1 element without it retunring an error e.g. Warning: Illegal string offset 'steamid' in /opt/lampp/htdocs/lan/lan-includes/scripts/class.steam.php on line 48
string(1) "R"
So I can print one element, and if I add another it returns errors.
EDIT -- Thanks for help,
So this was my solution:
function test_steamAPI()
{
$api = ('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key='.get_Steam_api().'&steamids=76561197960435530,76561197960435530');
$data = decode_url($api);
foreach($data ['response']['players'] as $player)
{
echo "Steam id:" . $player['steamid'] . "\n";
echo "Community visibility :" . $player['communityvisibilitystate'] . "\n";
echo "Player profile" . $player['profileurl'] ."\n";
}
}
//Function to decode and return the data.
function decode_url($url)
{
$decodeURL = $url;
$json = file_get_contents($decodeURL);
$data_output = json_decode($json, true);
return $data_output;
}
Worked this out by taking a look at the data.. and a couple json examples, this returns an array based on the Steam API URL (It works for multiple queries.... just FYI) and you can insert loops inside for items etc.. (if anyone searches for this).
hi
suppose i have
what i want is inside maindiv i want to count no of elements(may be div input tags)present.
there may be use of getElementByTagName().
But the problem is that how to count element.
Thanks
I'm trying to remove the background image on a page that's being loaded via an iframe within a lightbox effect. I have verified that body is the correct element within the iframe that's being selected, but I can't get the background image to go away. Am I missing something obvious?
var body = jQuery('#fancybox-frame').contents().find('body');
body.css({
'background': '',
'background-image': '',
'background-color': '#fff'
});
I have a load action tied to the submit button of a form.
jQuery('#content').load("/control/ajxdata/installs.php?country=" + country);
jQuery('#content').load("/control/ajxdata/installs.php",{ 'country': country });
The name, and the id of the form element I am trying to utilize is "country"
In the error console, I am getting "Error: country is not defined"
Using only keyboard, how can I select non-consecutive options of a multiple select element. On Firefox or Windows explorer, I can simply ctrl+Arrow to move the focus and then space bar to select. But I don't see any way to make it work on IE.
Thanks
Hi,
I have file upload UI element in which the user will upload images. Here I have to validate the height and width of the image in client side. Is it possible to find the size of the image having only the file path in JS?
Note: If No, is there any other way to find the dimensions in Client side?
Hi, I'm trying to attach to a clicked() signal, from a QGraphicsView, which is not normally available. With autoconnect, I get only QMetaObject::connectSlotsByName: No matching signal for on_xxx_clicked()
How can I capture clicks on that element?
Thanks
I've got a problem with the removal of entities in my JPA application: basically, I do in this EJB Business method:
load photo list ;
for each photo {
//UPDATE
remove TagPhoto element from @OneToMany relation
//DISPLAY
create query involving TagPhoto
...
}
and this last query always throws an EntityNotFoundException (deleted entity passed to persist: [...TagPhoto#])
I think I understand the meaning of this exception, like a synchronization problem caused by my Remove, but how can I get rid of it?
Hello all,
I'm trying to retrieve a listing of a user's youtube videos and embed them in a page using jQuery. My code looks something like this:
$(document).ready(function() {
//some variables
var fl_obj_template = $('<object width="260" height="140">' +
'<param name="movie" value=""></param>' +
'<param name="allowFullScreen" value="true"></param>' +
'<param name="allowscriptaccess" value="always"></param>' +
'<embed src="" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="260" height="140"></embed>' +
'</object>');
var video_elm_arr = $('.video');
//hide videos until ready
$('.video').addClass('hidden');
//pull video data from youtube
$.ajax({
url: 'http://gdata.youtube.com/feeds/api/users/username/uploads?alt=json',
dataType: 'jsonp',
success: function(data) {
$.each(data.feed.entry, function(i,item){
//only take the first 7 videos
if(i > 6)
return;
//give the video element a flash object
var cur_flash_obj = fl_obj_template;
//assign title
$(video_elm_arr[i]).find('.video_title').html(item.title.$t);
//clean url
var video_url = item.media$group.media$content[0].url;
var index = video_url.indexOf("?");
if (index > 0)
video_url = video_url.substring(0, index);
//and asign it to the player's parameters
$(cur_flash_obj).find('object param[name="movie"]').attr('value', video_url);
$(cur_flash_obj).find('object embed').attr('src', video_url);
//alert(cur_flash_obj);
//insert flash object in video element
$(video_elm_arr[i]).append(cur_flash_obj);
//and show
$(video_elm_arr[i]).removeClass('hidden');
});
}
});
});
(of course with 'username' being the actual username).
The video titles appear correctly but no videos show up. What gives?
The target html looks like:
<div id="top_row_center" class="video_center video">
<p class="video_title"></p>
</div>
Given an element with unknown margin-left, how to increase its margin-left at a number say 100px?
For example, assuming the original margin-left is 100px, the expected result is 100px + 100px thus 200px finally.
Let's say I have the following...
<div id="text">Some text</div>
When my mouse goes over Some, Some will be returned and the same with text.
Is this possible without putting each node into it's own element?
I was working with Zend on Ubuntu and it was working correctly. Now I moved to windows for same project. But now elements of my form are not rendered correctly and their code is appeared on brower's page like this:
translate( $this->element->getElement("email")->getLabel() ) ?>
Any idea that what is the problem?
I want to iterate over each line in the output of ls -l /some/dir/*
Right now I'm trying: for x in ls -l $1; do echo $x done, however this iterates over each element in the line seperately, so i get
-r--r-----
1
ivanevf
eng
1074
Apr
22
13:07
File1
-r--r-----
1
ivanevf
eng
1074
Apr
22
13:17
File2
I want to iterate over each line as a whole, though.
How do I do that?
Thanks.
I want to get and pass the HTML element(a textbox) value as a query string to the Ajax.ActionLink(), is this possible? If yes, then please tell me how? Thanks in advance
okay, C++ and java i have no problem learning or what so ever
when it comes to mips it is like hell
okay i wanna learn how to read in the an array and print all the element out
here is a simple array that i wrote
int[] a = new int[20];
for(int i=0; i
for(int j=0; j
how do you do it in mips
Is there a way to map an event such as a click-event on this element
<div>Just normal text</div>
to the position in the contained text ( "You just clicked the 6th character", when hitting the 'n' )?
I'm trying to rotate a canvas element AFTER it's been appended to the DOM.
Canvas is 600x50 and this is the code at hand:
var canvas = document.getElementsByTagName('canvas')[2];
var ctx = canvas.getContext('2d');
ctx.translate(300, 25); // rotate @ center
ctx.rotate(angle * Math.PI/180);
which isn't accomplishing the task. Am I missing something?
Thanks
Hi there,
I'm looking for a jQuery plugin which does scrolling the element (div) when I hover the arrow, it should look like this: http://img42.imageshack.us/img42/5716/scrollp.jpg and scroll automatically the content inside to the left/right only when user hovers arrows.
Is there anything like this?
Thanks a lot, Jakub
I'm trying to stop a non-css animation:
http://jsbin.com/aqute4/4/edit
Button 1 starts the animation nicely, totally lost on how to stop it though, since .stop() seems to need a DOM element... rather than a random object.
Thanks in advance.
PS: Original code comes from: http://james.padolsey.com/javascript/fun-with-jquerys-animate/