Skip to content

Update for use several times in the ASP.NET page#35

Open
dimitridup wants to merge 1 commit intokthornbloom:masterfrom
dimitridup:patch-1
Open

Update for use several times in the ASP.NET page#35
dimitridup wants to merge 1 commit intokthornbloom:masterfrom
dimitridup:patch-1

Conversation

@dimitridup
Copy link
Copy Markdown

Add parameter ctrlId (div ID) to use Smoothproducts several times in the page.
For example in a repeater ASP.net

Add parameter ctrlId (div ID) to use Smoothproducts several times in the page.
For example in a repeater ASP.net
@kthornbloom
Copy link
Copy Markdown
Owner

Hi, can you explain a bit more about what you've done here? The plugin should allow for multiple instances by default.

@dimitridup
Copy link
Copy Markdown
Author

dimitridup commented Apr 18, 2017

Hello,

I have make this modification to use X time Smoothproducts in the same page with controls ASP.NET

Exemple in ASP.net / C#
` //Slide Control

//ASP
<asp:Panel runat="server" ID="panimgArt" >
<asp:Panel runat="server" ID="wrapper">
<.div class="sp-loading"><.img src="images/sp-loading.gif" alt="">LOADING MAGES</div.>
<asp:Panel ID="slider" runat="server" class="sp-wrap">
<asp:Repeater runat="server" ID="repeater1">

<asp:Literal ID="Literal1" runat="server" Text='<%# Container.DataItem %>' OnDataBinding="lbl_DataBinding"></asp:Literal>

</asp:Repeater>
</asp:Panel>
</asp:Panel>
</asp:Panel>

//C#
protected void lbl_DataBinding(object sender, EventArgs e)
{
Literal lblimg = (Literal)sender;
string file = lblimg.Text;
lblimg.Text = "<a href="" + file + ""><img src="" + file + "" alt="" ><\a>";
}

protected void Page_Load(object sender, EventArgs e)
{
string javascriptInit = "$('#" + slider.ClientID + "').smoothproducts('#" + slider.ClientID + "');";
if (!IsPostBack || !Page.ScriptManager.IsInAsyncPostBack)
{
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Init_" + this.ClientID, javascriptInit, true);
}
else
{
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Reload_" + this.ClientID, javascriptInit, true);
}
}

// Show Control

//ASP
<asp:Repeater runat="server" ID="repeater1">

<uc1:ctrlSlide runat="server" ID="ctrlSlide1"/>

</asp:Repeater>

//C#
protected void Page_Load(object sender, EventArgs e)
{
repeater1.DataSource = DataSource // Datasouce containe X list images
repeater1.DataBind();
}`

@dimitridup dimitridup changed the title Update for use several times in the page Update for use several times in the ASP.NET page Apr 28, 2017
KrzysztofPajak pushed a commit to KrzysztofPajak/Smoothproducts that referenced this pull request Oct 16, 2018
Update for use several times in the ASP.NET page kthornbloom#35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants