|
Hi,
I have used this code to change the cell value :
<script type="text/javascript">
function Open(IdNeed)
{
var grid = document.getElementById('<%=gvEstelam.ClientID%>');
grid.rows[1].cells[4].innerHTML = 152;
alert(grid.rows[1].cells[4].innerHTML);
}
the alert show that the "grid.rows[1].cells[4]" value has changed to 152 and also in gridview it changed
BUT
when i click on OK button of alert then the value is change same as before(ex.500).
How to set the new value to remain ?
And this is my cell code :
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="ImageEstelamBuyingKala" ImageUrl="~/ServerFile/ApplicationFiles/Icons/Button/add.png"
Width="25" runat="server" OnClientClick='<%# " Open("+ DataBinder.Eval(Container.DataItem,"Id") + ");" %>' />
</ItemTemplate>
</asp:TemplateField>
modified 22-Dec-12 11:03am.
|
|
|
|
|
Hi,
You can check the OK button event:
if the Gridview has been reload?
Or you paste your code here
Comm100 - Leading Live Chat Software Provider
modified 28-May-14 1:47am.
|
|
|
|
|
Hello,
I have created one file upload control in my asp.net page,now when ever i upload html page using this file upload ,i want to add one anchor tag to this html page.
Any Suggestions ??
Regards,
Ravi Vyas
|
|
|
|
|
i am not clear with your question,
do you want to add one more anchor tag in your html file?
in that case you need to write into your html file and append the data in the body section.
Let us know if this is your query.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
|
Hi,
If you want to add the anchor tag to the uploaded file?
Then you should read the file and edit the file and create a new file...
Comm100 - Leading Live Chat Software Provider
-- modified 28-May-14 1:47am.
|
|
|
|
|
|
What is wrong with you?
No more Mister Nice Guy... >: |
|
|
|
|
|
I think that he want to add link to uploaded html, but that is just guess.
No more Mister Nice Guy... >: |
|
|
|
|
|
Hi,
I have jquery implemented for the popup confirmation on radio button select. So my radio button has yes or no options. so in each select, the popup should show up and based on the option, it has to hide and show the panel. But the problem is sometimes for the same option, jquery runs and sometimes for the same option jsquery doesn't run.
the following jquery is in my aspx page.
<script language="JavaScript" type="text/javascript">
$(document).ready(function() {
function confirmDelete()
{
if (confirm('It will delete your file. Is that Ok?'))
{
document.getElementById('<%= radbutSelector.ClientID %>').click();
return true;
}
return false;
}
</script>
Now i have called this jquery on radio button select like this
<asp:radiobuttonlist id="radWantEnter" runat="server"
RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="radio"
AutoPostBack="True" onclick="return confirmDelete();"
>
<asp:Button Text="hiddenButton" ID="radbutSelector" runat="server" Style="display: none;"
OnClick="radbutSelector_Click" />
And the code behind the radio button select is like this
protected void radbutSelector_Click(object sender, EventArgs e)
{
if (radWantEnter.SelectedValue == "Yes")
{
pnl1.Visible = true;
}
else
{
pnl2.Visible = false;
}
}
sometimes the radbutSelector executes its codes and sometimes its not for the same event. Any idea and any solutions would be great help.
Dhyanga
modified 19-Dec-12 18:05pm.
|
|
|
|
|
That's a csharp code behind function, there is no Jquery on any example except for $(document).ready. and that's not correct either. You don't need document ready unless your binding events with the document ready.
I can't see how confirm delete works, where does the object confirm come from?
<script language="JavaScript" type="text/javascript">
$(document).ready(function() {
});
function confirmDelete()
{
if (confirm('It will delete your file. Is that Ok?'))
{
document.getElementById('<%= radbutSelector.ClientID %>').click();
return true;
}
return false;
}
</script>
|
|
|
|
|
The script is like this:
<script language="JavaScript" type="text/javascript">
function confirmDelete()
{
if (confirm('It will delete your file. Is that Ok?'))
{
document.getElementById('<%= radbutSelector.ClientID %>').click();
return true;
}
return false;
}
</script>
Dhyanga
|
|
|
|
|
In Jquery, it's more along the lines of this. I guessed at the ID or the radio button set, won't work, just an example of how to format it. but it's closer to what you want.
So it binds the change event to the DOM, and fires the function, passing the event to it. Radio buttons are checkboxs, they act the same, and have the same events, so think of them as checkboxes. If you have a group of them, say 2, then you have to get the selected index of the 2 radio buttons, which is an array of values, from the DOM. That's what the [0] is for.
I was about to leave tor the night and sleep, but wanted to help a little more if possible. I can tell your not that familiar with Jquery. If you have an update panel on the page, this won't work after using the update panel once, because the DOM unloaded.
<script language="JavaScript" type="text/javascript">
$(document).ready( function() {
$('[id*="radbutSelector"]').change( function(event) {
confirmDelete(event);
});
});
function confirmDelete(event) {
var newradio= $("input[name='pick_up_point']:checked")[0];
if (newradio===currentradio)
return;
if (confirm('Address details will be cleared. Continue?')) {
clearInputFields();
currentradio= newradio;
} else {
currentradio.checked= true;
}
}
</script>
|
|
|
|
|
The system currently has a few users, created from the login feature used with mvc3 razor. how Can I assign one of these users to the administrator?
thanks
|
|
|
|
|
in my Get/Index view I am posting to my Post/Index method in the holidayController. So i am posting over the UserID, how can I use this to access the userName?
Iv tried
public ViewResult Index(int userID, string userName)
{
Person person = new Person();
person.Id = userID;
userName = person.name;
}
This is flashing up cant be null for person.name?
|
|
|
|
|
Where is the user ID coming from? Do you have a database and a model (LINQ To SQL or EF)? If so, I believe you would just use a query to retrieve the Person entity where the ID matches the userID parameter. Then you could assign person.Name to the userName variable.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Hi,
try this:
public ViewResult Index(int userID, string userName)
{
Person person = new Person(userID);
//this assigns person.Id to the user Id
//person.Id = userID;
//i want to assign name of person to the string userName
userName = person.name;
}
and you should define the class Person with id:
public Person(int id)
{
//get the person from DB or ...
_name = "data from DB";
}
Comm100 - Leading Live Chat Software Provider
-- modified 28-May-14 1:47am.
|
|
|
|
|
HI
I am using Visual Studio 2008 to develop web application in Windows XP Internet explorer-8. If i run first time i wont get any error. In 2nd time i will get Unable to start program http://localhost:1837/default.aspx after that every time it is coming like that. I am not able to get debug point. How to solve this issue.
If anybody knows, please reply me.
thanks in advance.
|
|
|
|
|
So I only want the logged in user to be allowed to book holidays for them selves. I think the easiest way to do this is to compare 'name' of logged in user againast 'name' in person table. So....
public ActionResult Create()
{
string xx = (string)Session["usernameID"];
int? currentPersonID = Convert.ToInt32(xx);
string userNameComparedAgainstLoginName =
CreateModel model = new CreateModel();
model.currentPersonID = currentPersonID.Value;
model.PList4DD = db.People.ToList();
if (userNameComparedAgainstLoginName == model.userName)
{
ViewBag.Id = new SelectList(db.People, "Id", "Name");
return View(model);
}
else
{
TempData["canOnlyBookHolidaysForYourself"] = "I'm afraid you can only book holidays for yourself";
return RedirectToAction("Index");
}
}
---------------------------------------
the name given when the user registers will be the same names used in the db.
So could someone tell me how I can access the logged in 'name'?
Thanks
|
|
|
|
|
forgot to mention Its just the automatic login that comes with mvc3 razor
|
|
|
|
|
So a drop down is used to select the users name, then click 'view' and it will display all the holidays this user has previously booked.
From here the user can click 'create new' which will bring them to a create new page. Instead of having to re-select their name from another drop down i carried across the currentuserID and replaced the second drop down with the users ID.
Everything was working fine with 2 separate drop downs, the user could book holidays etc... However now (after I changed the second drop down to hold the ID value) I am getting an error from my listHoliday Method in my controller:
Error: InvalidOperationException was unhandled by the user code Sequence contains no elements
var dbPerson1 = (from p in db.People
where p.Id == PersonId
select p).Single();
Could anyone advise what to do? Im lost thanks for any replies.
|
|
|
|
|
First, make sure the proper set of ID values is actually being bound to the drop-down. Secondly, the "Single()" method will throw that exception if the query does not return any results. If it's possible that the "p.Id == PersonId" condition could yield ZERO results, use "SingleOrDefault()" instead, which will assign a null value to dbPerson1 if nothing is found with the query.
I'd say debug with a breakpoint and verify that, for one, the drop-down has the correct ID's assigned to it, and also that "PersonId" is capturing the correct value. Also, make sure that the "PersonId" does in fact exist in the "People" table.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
hey matt...thanks for teh reply man that sorted it
|
|
|
|
|
What was the issue? Was the list not getting the correct values or did a "SingleOrDefault()" call take care of it?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Im using a session variable to pass the user ID from the Index to the Create in the HomeController. ATM the user can use a drop down to select their name from the list of users and click 'View' to list the holidays they have previously booked. From there the user can click 'create' which will bring the user to a page which enables them to create a new holiday. From here they have to select their name again from the drop down list.
I want to store the users ID from the previous drop down so it will update automatically if they try to create another holiday (to replace the second drop down)
Im using a session variable to do this, iv put
Session["userameID"] = currentID;
in my view. Iv break pointed it just after and if I hold my mouse over 'currentID' it displays the correct ID of the user.
So iv tried to pass this down to the create method using
string xx = (string)Session["usernameID"];
However string 'xx' is returning NULL,., (tested with breakpoint)
I then placed the entire session in the view
Session["userameID"] = HolidayDate;
string xx = (string)Session["usernameID"];
and string 'xx' is still returning null.
Is it not meant to return the userID???
Thanks for any replys
|
|
|
|