|
If you want a pause, you need to turn the images off an one in your move over and mouse out events.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
<script language=javascript>
function loadPage()
{
// Write your functionality
}
// This function is resposible for calling loadPage after time interval (given as second parameter)
setTimeout("loadPage()",1000);
</script>
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
I am having a page on which a grid view is displaying some message posted by the users.
The messages are stored in the database in a table having columns for MessageId,UserId and Message.
Now i want to add buttons like, 'Edit' / 'Delete' (after displaying every message)which will be visible to only the author of that message and to the administrator.
Using that button, the users shall be able to edit/delete the message.
I am able to add those buttons, but how to make them visible/invisible depending on the userid and the 'role' in which the user is logged in.
Please help ...
Apurv
|
|
|
|
|
((Button)e.Row.FindControl("edit")).Visible = false;
something like the above
|
|
|
|
|
do u mean, i need a parent control and in that i need to search for the id of the edit button ?
but then all the messages having edit button would be selected, then ....
Because the edit button will be present after every message ...
Apurv
|
|
|
|
|
apr ~ asp wrote: but then all the messages having edit button would be selected, then ....
Whats the problem with the button being disabled for all rows?
apr ~ asp wrote: Because the edit button will be present after every message ...
I thought that was what you wanted and then you can check if the user is normal or admin and depending on which display or hide the button using the code I posted
|
|
|
|
|
.netman wrote: you can check if the user is normal or admin and depending on which display or hide the button
what 'id' to use ? make visible/invisible ??
Apurv
|
|
|
|
|
is there any way to add the 'if' statement in the aspx page, where the code for button is present ?
Apurv
|
|
|
|
|
use the ID of the button.
Put the code in your c#, so for example here is mine:
protected void OnRowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (Common_methods.userPermission("admin") == false)
{
((CheckBox)e.Row.FindControl("buttonid")).Visible = false;
}
}
}
then use onrowcreated method for your gridview
make sense?
|
|
|
|
|
Thanx friend ....
i will try it ...
Apurv
|
|
|
|
|
Its working perfectly friend ...
BUT the person who has posted the message shall be able to edit/delete it ...
While loading the messages from the database to the gridview, the userid is also loaded ...
is there any way, by which when the row is created in the gridview, and the corresponding event handler is called, the userids can be compared ...
Apurv
|
|
|
|
|
Hi !
Is there any known performance issues concerning run-time manipulation with Style object ?
I used ANTS profiler to profile my application and suddenly found that the following Style.Add statement is one of the slowests:
<br />
tb = (Table)this.FindControl("ContentTable");<br />
if (tb != null)<br />
{<br />
if (this.Language == InputLanguage.Hebrew)<br />
{<br />
tb.Style.Add(HtmlTextWriterStyle.Direction, "rtl");<br />
<br />
}<br />
else<br />
{<br />
tb.Style.Add(HtmlTextWriterStyle.Direction, "ltr"); <br />
}<br />
}<br />
<br />
If those performance issues are exist, is there any work around?
Thanks in advance.
Regarads,
Gennady
|
|
|
|
|
It should not have much performance issue just you are changing the style
Is the Page is very complex and big in size ? then it may take some time
to locate your ContentTable(not considerable time).
i don't think it is going to have performance issue.
This is what i think.
Any inputs from others ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
I agree.
But still if you feel that it is an over head. Another solution may be to pass your language name to the javascript and change the style at the client side itself.
|
|
|
|
|
Hi !
Page is not too complex. And findcontrol takes significantly less time:
FindControl - 0.0083
Style.Add - 0.606
As for passing this action to the client - I considered this alternative way, but first I'd like to understand - what is going wrong on the server side.
Thanks.
Regards,
Gennady
|
|
|
|
|
I guessed it
I don't know exact what happening ?
Is it degrading the performance ? Please let me know if you get the answer
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
Sandeep Akhare wrote: Is it degrading the performance ?
This was the question !!
I think it is. At least the page load.
BTW, I forgot to note, that my application runs on VM (W2K3 on VMware ESX). If it is important ...
Regards,
Gennady
|
|
|
|
|
I have a drop downlist on server with a list of groups from the logged in user. When the user select a group from the drop down list I have to add a "Remove" link next to this drop down list and anohter link "Add to another group" down to this drop down list. If the clicks on this link then another drop down list with the groups except the one user selected in the above drop down list should be created on top of it. Does any one please tell me, how to do this and I have a sample image of my explanation in this link:
http://www.doxtop.com/Browse/3645e617/addtomultiplegroups.aspx?private_key=fca98fbb
Here is my code: I could add new drop down list on clicking the "Add another group" link but I need to get the items in the new drop downlist as items- the previous selected item.
<tr id="trGroups" style="display: none;">
<td class="tdUpload10">Groups:</td>
<td id="tdGroups"> <asp:DropDownList ID="ddlGroups" runat="server" CssClass="dropdown1" Width="50%">
</asp:DropDownList> <a href="" id="lRemovePub" runat="server" class="link1" style="display:none;vertical-align:top">Remove </a>
<div id="divDDLMore" style="display:none;vertical-align:top">
</div> <div id="div1" runat="server" style="display:none"> Attached successfully. <a href="" id="A3" runat="server" class="link1">Remove </a></div> </td> </tr>
<tr id="trMoreGroups" style="display:none;vertical-align:top" runat="server">
<td> </td> <td>
<a href="" id="lMoreGroup" runat="server" class="link1" onclick="AddToMoreGroups()">Add to another group</a> </td> </tr>
Here is my javascript code:
function AddToMoreGroups()
{
var tdGroups = document.getElementById(tdGroups);
var ddlGroupId = document.getElementById(ddlGroupsId);
var trMoreGroups = document.getElementById(trMoreGroupsId);
var ddlGroups = '';
ddlGroups += '<select class=\"dropdown1\" style=\"width:50%\" id=\"ddlGroups\" runat=\"server\">';
var groupsArray = allGroups.split(';');
if(groupsArray != '')
{
ddlGroups += "<option value = '" +emptyGroup +"'>Select Group...</option>"
for(var i =0; i <groupsArray.length; i++)
{
var grArr = groupsArray[i].split(',');
ddlGroups += "<option value='"+ grArr[0] +"'>" +grArr[1]+"</option>"
}
}
ddlGroups += "</select> <a runat=\"server\" class=\"link1\" style=\"display:none;vertical-align:top\">Remove </a> <br/>"
divDDLMore.innerHTML += ddlGroups;
divDDLMore.style.display = '';
trMoreGroups.style.display = 'none';
}
function SetAudience()
{
var ddlGroupId = document.getElementById(ddlGroupsId);
var trMoreGroups = document.getElementById(trMoreGroupsId);
var lRemovePub = document.getElementById(lRemovePubId);
// Get Selected Value
var GroupId = '00000000-0000-0000-0000-000000000000';
if(ddlGroupId != null)
{
for(var i=0; i < ddlGroupId.options.length; i++)
{
if(ddlGroupId.options[i].selected == true)
{
GroupId = ddlGroupId.options[i].value;
if(GroupId != '00000000-0000-0000-0000-000000000000')
{
trMoreGroups.style.display = '';
lRemovePub.style.display = '';
}
break;
}
}
}
}
Any Ideas please!!!
|
|
|
|
|
If you're adding them on the client, they won't appear in viewstate, but they will appear in the form that gets posted back to the server.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
As you can see in my code I could store the selected groupIds in a variable and add the items by checking these groupIds.
I have another problem here. I created my other drop down lists on client side using javascript and all the html code for the to a but on the JS side if i want to get the items I am popping up with the javascript error.
Here the first line is breaking. Can't get the items of my drop down list created on client side.
for(var i=0; i < ddlGroups.options.length; i++)
{
if(ddlGroups.options[i].selected == true)
{
grId = ddlGroups.options[i].value;
break;
}
}
|
|
|
|
|
(1) i want a master page fill from database in datalist control.
(2) when i click on datalist linkbutton open a new page related to click.
problem:-
(1) if i use in master page contentplaceholder and under this use datalist than datalist is not filled error return nullvalue exception.
(2) if i use without contentplaceholder then working properly but problem is that its goes out from panel.
how to solve this problem.
any body help me?
thanks in advance.
|
|
|
|
|
1 - put the datalist in the master page, what's the issue ?
2 - use target="_blank" to open a new page
Hard to say why you have an exception without seeing the code. Haven't you been asking this all day ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Why are you using Master Page ?
Do you need to display datalist in each page ?
If yes do one thing instead of putting directly in Master Page
Put the DataList in the ASP.Panel and give it height and width.
You can't put the datalist directly in Contentplaceholder
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
code is
<asp:contentplaceholder runat="server" id="cph1" xmlns:asp="#unknown">
<asp:panel runat="server" id="pnl1">
<asp:datalist runat="sever" id="dl_1">
---code item template
---code item template and binding
commnad etc working properly but i use iframe for scrolling bar.
but open in iframe panel. not open new page.
|
|
|
|
|
Just remove the ContentPlaceHolder and have your datalist in the Panel
give proper height and width to your Panel
I don't understand why you are using Master Page ?
you should explain the necessity of using the master Page as it is common for all pages to show common Layout
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|