Search Results

Search found 6 results on 1 pages for 'toraan'.

Page 1/1 | 1 

  • Share data between usercontrols

    - by toraan
    On my page I have n-userControls (same control) I need to communicate between them(to be more specific I need to pass one in value) . I don't want to involve the hosting page for that. The controls acts as "pagers" and interact with the paged data on the hostin page via events that hosting page is subscribed to. So when user click on one of the pager and changes it's state, the other control should know about it and change itself accordingly. I can not use VieState because viewstate is per control and so is the controlstate. Can I use Session for that? (session is shared and there is only one value that i need to store) Or maybe there is something better I can use? (no QueryString)

    Read the article

  • Problem with page lifecycle

    - by toraan
    I have a basic question: my page: <div> <asp:LinkButton ID="LinkButton0" onclick="LinkButton_Click" runat="server" CommandArgument="0">0</asp:LinkButton> <asp:LinkButton ID="LinkButton1" onclick="LinkButton_Click" runat="server" CommandArgument="1">1</asp:LinkButton> <asp:LinkButton ID="LinkButton2" onclick="LinkButton_Click" runat="server" CommandArgument="2">2</asp:LinkButton> <asp:LinkButton ID="LinkButton3" onclick="LinkButton_Click" runat="server" CommandArgument="3">3</asp:LinkButton> </div> code behind: protected void Page_Load(object sender, EventArgs e) { Foo (PageIndex); } int _pageIndex; public int PageIndex { get { object objPage = ViewState["_pageIndex"]; if (objPage == null) { _pageIndex = 0; } else { _pageIndex = (int)objPage; } return _pageIndex; } set {ViewState["_pageIndex"] = value; } } protected void LinkButton_Click(object sender, EventArgs e) { PageIndex = int.Parse(((LinkButton)sender).CommandArgument); } The problem is with Page_Load event, I expect to get new PageIndex after the linkbutton is clicked.

    Read the article

  • Detect click events outside div inside usercontrol

    - by toraan
    I have a div inside a user control that is displayed by the user after some event. I want to hide this div when user clicks anywhere elese on the page but not on the div (or not on any element that is inside the div). If it wasn't a user control I could use body's clieck event to check the target, but because this is usercontrol that is hosted by other page I can't just "play" with it's elements. How can I achieve that without using body of the hosting page?

    Read the article

  • Setting ID to a control inside repeater itemtemplate

    - by toraan
    Inside repeater's itemtemplate I have a Panel server control. I need to assign special Id for it, because I need to work with some javascript functions that use this Id. In repeater ItemDataBound event I have this: pnlButtonsPanel.ID = pnlButtonsPanel.ID + DataBinder.Eval(e.Item.DataItem, "ID"); But this solution is not good because after a postback the page is re -rendered and I lose the new ID. (And I don't want to rebind repeater after every postback) I tried to set the ID on aspx page like that: <asp:Panel id='<%# Eval("ID") %>' and some other variations but always get compile errors.

    Read the article

  • Asp controls Id generation inside repeater

    - by toraan
    I define some controls inside repeater itemtemplate, the problem is with the Id that are generated automatically. This is my page: <asp:Repeater ID="rptThreads" runat="server" onitemcreated="rptThreads_ItemCreated"> <HeaderTemplate> <table cellpadding="0px" cellspacing="0"> </HeaderTemplate> <ItemTemplate> <tr style="height:50px"> <td> <asp:PlaceHolder ID="plcItemTitle" runat="server"> <asp:Panel id="titleContainer" runat="server" style="position:absolute;"> <asp:HyperLink ID="lnkTitle" runat="server" style="float:left;padding-right:10px;" Text='<%# Container.DataItem%>'/> <asp:Panel id="pnlEditButtons" runat="server" Visible="false" style="vertical-align:middle;z-index:100;display:none;float:left;" > <asp:ImageButton ID="imgbtn1" runat="server" ImageUrl="~/Images/misc/edit.png" /> <asp:ImageButton ID="imgbtn2" runat="server" ImageUrl="~/Images/misc/Rename.png" /> </asp:Panel> </asp:Panel> </asp:PlaceHolder> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> Now I will try to describe the problem: code-behind: protected void Page_Load(object sender, EventArgs e) { int [] array = {1,2,3,4,5}; rptThreads.DataSource = array; rptThreads.DataBind(); } protected void rptThreads_ItemCreated(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Panel editButtonsPanel = e.Item.FindControl("pnlEditButtons") as Panel; editButtonsPanel.Visible = true; Panel containerPanel = e.Item.FindControl("titleContainer") as Panel; //Point of Interest!!!! containerPanel.Attributes.Add("onmouseover", "ShowEditButtons('" + editButtonsPanel.ClientID + "');"); } } If I run the page as is, the generated html will be the following (I show only the first 2 items): <table cellpadding="0px" cellspacing="0"> <tr style="height:50px"> <td> <div id="titleContainer" onmouseover="ShowEditButtons('pnlEditButtons');" style="position:absolute;"> <a id="lnkTitle" style="float:left;padding-right:10px;">1</a> <div id="pnlEditButtons" style="vertical-align:middle;z-index:100;display:none;float:left;"> <input type="image" name="imgbtn1" id="imgbtn1" src="Images/misc/edit.png" style="border-width:0px;" /> <input type="image" name="imgbtn2" id="imgbtn2" src="Images/misc/Rename.png" style="border-width:0px;" /> </div> </div> </td> </tr> <tr style="height:50px"> <td> <div id="titleContainer" onmouseover="ShowEditButtons('pnlEditButtons');" style="position:absolute;"> <a id="lnkTitle" style="float:left;padding-right:10px;">2</a> <div id="pnlEditButtons" style="vertical-align:middle;z-index:100;display:none;float:left;"> <input type="image" name="imgbtn1" id="imgbtn1" src="Images/misc/edit.png" style="border-width:0px;" /> <input type="image" name="imgbtn2" id="imgbtn2" src="Images/misc/Rename.png" style="border-width:0px;" /> </div> </div> </td> </tr> As you can see all divs get the SAME ID, THIS I DONT WANT!!! But If I omit this line form the ItemCreated event: containerPanel.Attributes.Add("onmouseover", "ShowEditButtons('" + editButtonsPanel.ClientID + "');"); The generated HTML will be the following: <table cellpadding="0px" cellspacing="0"> <tr style="height:50px"> <td> <div id="rptThreads_ctl01_titleContainer" style="position:absolute;"> <a id="rptThreads_ctl01_lnkTitle" style="float:left;padding-right:10px;">1</a> <div id="rptThreads_ctl01_pnlEditButtons" style="vertical-align:middle;z-index:100;display:none;float:left;"> <input type="image" name="rptThreads$ctl01$imgbtn1" id="rptThreads_ctl01_imgbtn1" src="Images/misc/edit.png" style="border-width:0px;" /> <input type="image" name="rptThreads$ctl01$imgbtn2" id="rptThreads_ctl01_imgbtn2" src="Images/misc/Rename.png" style="border-width:0px;" /> </div> </div> </td> </tr> <tr style="height:50px"> <td> <div id="rptThreads_ctl02_titleContainer" style="position:absolute;"> <a id="rptThreads_ctl02_lnkTitle" style="float:left;padding-right:10px;">2</a> <div id="rptThreads_ctl02_pnlEditButtons" style="vertical-align:middle;z-index:100;display:none;float:left;"> <input type="image" name="rptThreads$ctl02$imgbtn1" id="rptThreads_ctl02_imgbtn1" src="Images/misc/edit.png" style="border-width:0px;" /> <input type="image" name="rptThreads$ctl02$imgbtn2" id="rptThreads_ctl02_imgbtn2" src="Images/misc/Rename.png" style="border-width:0px;" /> </div> </div> </td> </tr> All divs get unique IDs, and this I do want My questions are: 1)why it happens? why this line of code messup the ids? 2)how can have the unique ID's and assign javascript in codebehind? I can add this on aspx (it will wotk and I will get unique ids): onmouseover='<%# "javascript:ShowEditButtons(\""+ Container.FindControl("pnlEditButtons").ClientID+ "\");" %>' But I must do it in codebehind because I need to set the javascript only if server validate some things.

    Read the article

  • Using getElementById inside user control

    - by toraan
    I have a usercontrol that hides a div when a button is clicked. <asp:LinkButton ID="lnkbtn" OnClientClick="ShowHide(); return false;" runat="server" /> <div id="popupPage" style="display:none;"> </div> function ShowHideGotoPopUp() { var ob = document.getElementById("popupPage"); if (ob.style.display == "none") ob.style.display = "block"; else ob.style.display = "none" } There is a problem when I place on page more then 1 usercontrol, all controls has div with same id = popupPage.

    Read the article

1