repeater Button event in formview asp.net - repeater

ItemCommand contains RepeaterCommandEventArgs which has two important fields:
CommandName
CommandArgument
how to get Button event,get asp:DropDownList select values
<asp:FormView runat="server" id="fwHotelDetails" DataKeyNames="id" OnDataBound="fwHotelDetails_DataBound" OnModeChanging="fwHotelDetails_ModeChanging" >
<ItemTemplate>
<asp:Repeater runat="server" id="repScore">
<ItemTemplate>
<asp:DropDownList ID="ddlnumber" runat="server">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:DropDownList>
<asp:LinkButton ID="saveButton" runat="server" CausesValidation="False" CommandName="Edit" CommandArgument='<%# Eval("id")%>' Text="Edit" />
</ItemTemplate>
</asp:Repeater>
<EditItemTemplate>
Test test, anything??
</EditItemTemplate>
</ItemTemplate>
</asp:FormView>

The RepeaterCommandEventArgs argument contains a property called Item. From this property you can access the method FindControl().
So your code would look like this:
void repScore_ItemCommand(Object sender, RepeaterCommandEventArgs e) {
DropDownList ddl = (DropDownList)e.Item.FindControl("ddlNumber");
string selectedValue = ddl.SelectedValue;
}
Also, don't forget to wire up your repeater to handle the event:
<asp:Repeater ... OnItemCommand="repScore_ItemCommand" .... >

Related

Svelte-ChartJS chart binding

I am trying to use svelte-chartjs with chartjs-plugin-zoom. In order to programmatically adjust zoom. In order to do this you have to bind onto the element. This can be illustrated in the React-ChartJS-2 - see buttons below.
Is there a prop in svelte-chartjs to make that binding?
Something like:
<Line chartRef={myrefvar} {options} />
Use bind:property (tutorial) to get the chart reference ยป REPL
<script>
...
let chartRef
const onZoomPluse = () => {
chartRef.zoom(1.1);
};
</script>
<Line bind:chart={chartRef} options={options} data={data} />
<button on:click={onZoomPluse}>zoom +10%</button>

Checkbox label with URL link in Semantic UI React

Semantic UI React Checkbox can be used like this:
import React from 'react'
import { Checkbox } from 'semantic-ui-react'
const TermsOfServiceCheckbox = () => (
<Checkbox label='I accept the Terms of Service' />
)
export default TermsOfServiceCheckbox
How do I set the Checkbox label so that the text Terms of Service is a link to a URL?
label prop implements the item shorthand, so you can also pass there:
<Checkbox label={<label><a href='/'>I accept the Terms of Service</a></label>} />
<Checkbox label={<label>I accept the <a href='/'>Terms of Service</a></label>} />
<Checkbox label={{ children: <a href='/'>I accept the Terms of Service</a> }} />

Chaining CFWindow does not work as expected

I am new to ColdFusion but I received a project to create a web app.
I am stuck at making multiple cfwindow's. I have a page that displays all upcoming training classes (called page A). It allows an admin to click on a link to open a window and view all students registered for that class (called page B). In page B, I would like to have a link under each students name. When the instructor clicks on it, he can open another cfwindow containing a form for entering payment information. ie Check number sent by the student.
Here is what I've got so far:
Page A:
<script type="text/javascript">
function viewList(id)
{
try {
ColdFusion.Window.destroy('view', true);
}catch(e) {}
ColdFusion.Window.create('view','Registration List', 'registration_list.cfm?id=' + id, {center:true, width:300, height:100, model:true});
}
</script>
<!---output trainingid with a given query name--->
<cfoutput query="myqueryname">
<tr>
<td colspan="3" align="center">View Registration List</td>
</tr>
</cfoutput>
<cfajaximport tags = "cfwindow">
<cfajaximport tags = "cfform">
Page B:
<script type="text/javascript">
function showDetail(detailid)
{
try {
ColdFusion.Window.destroy('viewFull', true);
}catch(e) {}
ColdFusion.Window.create('viewFull','Detail List', 'detail_form.cfm', {center:true, width:300, height:100, modal:false});
}
</script>
<cfoutput query="viewregistration">
First Name:#viewregistration.FirstName#<br />
Last Name: #viewregistration.LastName#<br />
Email: #viewregistration.Email# <br />
County: #viewregistration.Name#<br />
View
</cfoutput>
<cfajaximport tags = "cfwindow">
<cfajaximport tags = "cfform">
When I test my page and click on "View", nothing shows up. However, when I change onclick to display an alert(), it does work. Any idea how to solve this?

asp.net nested repeaters

I have some problems with nested repeaters. I have the following markup
<asp:UpdatePanel ID="upSupportDownloads" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="five-col">
<asp:Repeater ID="rep1" runat="server">
<ItemTemplate>
<asp:Repeater ID="rep2" runat="server">
<ItemTemplate></ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
...
It's not a working code, it's an example to understand my structure.
I can't access rep2 from my code behind. I can call rep1. But rep2 is invisible for me.
You need to find the nested repeater in the OnItemDataBound event of your main repeater. like this:
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView row = (DataRowView)e.Item.DataItem;
Repeater nestedRepeater = e.Item.FindControl("NestedRepeater") as Repeater;
nestedRepeater.DataSource = getMyData();
nestedRepeater.DataBind();
}

Slideshow from ASP.net to SP2007

I have a task to convert the following ASP.Net slide show to SharePoint 2007 and I was wondering if any of you can offer some pointers how to do it most efficiently. My SP environment is a small farm SQL + Web/SP server. I've built a small handful of custom data driven web parts so I know how to develop and publish. What I'm having difficulties with, is the web service that this sample app uses and how to make it work in SP, specifically, how to access my custom list that contains the images that will vary in members.
Here is what the aspx file looks like:
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication3._Default" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
Slide Show Example
<div style="text-align: center;" >
<asp:Image ImageUrl="images/Slide1.JPG" ID="Image1" runat="server" alt="image" height="300" Width="450"/>
<br />
<asp:Button ID="prevButton" runat="server" Text="Prev" />
<asp:Button ID="playButton" runat="server" Text="Play" />
<asp:Button ID="nextButton" runat="server" Text="Next" />
<asp:SlideShowExtender
ID="SlideShowExtender1" runat="server"
TargetControlID="Image1"
SlideShowServiceMethod="GetSlides"
SlideShowServicePath="SlideShowService.asmx"
AutoPlay="true"
PlayInterval="4000"
NextButtonID="nextButton"
PlayButtonID="PlayButton"
PlayButtonText="Play"
StopButtonText="Stop"
PreviousButtonID="prevButton"
Loop="true" />
</div>
</p>
... and the webservice:
namespace WebApplication3
{
[WebService(Namespace = "http://microsoft.com/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService()]
public class SlideShowService : System.Web.Services.WebService
{
[WebMethod]
public AjaxControlToolkit.Slide[] GetSlides()
{
AjaxControlToolkit.Slide[] MySlides = new AjaxControlToolkit.Slide[10];
MySlides[0] = new AjaxControlToolkit.Slide("images/Slide1.JPG", "Slide1", "Slide1");
MySlides[1] = new AjaxControlToolkit.Slide("images/Slide2.JPG", "Slide2", "Slide2");
MySlides[2] = new AjaxControlToolkit.Slide("images/Slide3.JPG", "Slide3", "Slide3");
MySlides[3] = new AjaxControlToolkit.Slide("images/Slide4.JPG", "Slide4", "Slide4");
MySlides[4] = new AjaxControlToolkit.Slide("images/Slide5.JPG", "Slide5", "Slide5");
MySlides[5] = new AjaxControlToolkit.Slide("images/Slide6.JPG", "Slide6", "Slide6");
MySlides[6] = new AjaxControlToolkit.Slide("images/Slide7.JPG", "Slide7", "Slide7");
MySlides[7] = new AjaxControlToolkit.Slide("images/Slide8.JPG", "Slide8", "Slide8");
MySlides[8] = new AjaxControlToolkit.Slide("images/Slide9.JPG", "Slide9", "Slide9");
MySlides[9] = new AjaxControlToolkit.Slide("images/Slide10.JPG", "Slide10", "Slide10");
return MySlides;
}
}
}
Thanks in advance! Have nice day.
Risho