|
I am creating on custom control.I have problem to create bubble event of that control.
Here is my code,In which I added one button control
protected override void RenderContents(HtmlTextWriter writer)
{
.....................
Button btn = new Button();
btn.Text=_updateTemplate.Text;
btn.ID = "ExelDataGrid_" + j.ToString() + i.ToString();
btn.CommandArgument = _rows[i - 1].ToString();
btn.CommandName = "update";
btn.RenderControl(writer);
...................
}
I have defined event
public event EventHandler Updating;
I am calling this method when buble event rise
protected virtual void OnUpdating(EventArgs e)
{
Updating(this, e);
}
protected override bool OnBubbleEvent(object source, EventArgs args)
{
OnUpdating(args);
return true;
}
Now when I use this control on my web application,then OnUpdating event doesn't call on button click event.
Can Anyone give me suggetion to solve this issue?
please don't forget to vote on the post that helped you.
|
|
|
|
|
Where have you decalred event for Button Click ?
I doubt you have done something wrong here
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
|
|
|
|
|
If I add button click event then also does not work.
Here is my code
public void btn_Click(object sender, EventArgs e)
{
this.RaiseBubbleEvent(sender, e);
}
.........
btn.Click += new EventHandler(btn_Click);
btn.RenderControl(writer);
...........
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hi friends
I have one aspx page, in which images are showing continuously.
on mouse over i want to delay this process
i need delay in javacript.
thanks
|
|
|
|
|
Don't repost your question.
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 have a tree each node in the tree has a check box how can I enable or disable this check box through javascript, please?
|
|
|
|
|
Hi friends
I have one aspx page, in which images are showing continuously.
on mouse over i want to delay this process
i need delay in javacript.
thanks
|
|
|
|
|
|
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
|
|
|
|