Well, suppose i have couple of controls in datalist and one of them is link
button control
how do i invoke link button controls click method in the datalist ???
Suppose link button control will send info back to server and redirect to
another page, how do i do it in datalist ?
I have following code in item templatae
<asp:LinkButt on id="Linkbutton1 " OnClick="OnClic kMethod"
runat="server"> Download Chapter</asp:LinkButton>
I want to be able to pass arguement to OnClickMethod [the arguement is
employee_id which comes from the table]
Something like when link button is clicked, it'll redirect to another page
containing employee details. 2 1464
In your ItemTemplate make the LinkButton have a CommandName="Do Something".
On your Datalist specify the primary key for the rows via the DataKeyField="e mployee_id"
attribute. Then handle the DataList's ItemCommand event to do something like
this:
protected void _dataList_ItemC ommand(object source, DataListCommand EventArgs
e)
{
if (e.CommandName == "DoSomethin g")
{
int employee_id = (int)_dataList. DataKeys[e.Item.ItemInde x];
// now do something with
}
}
But if your going to do all of this simply for a redirect, then it's much
simpler to just emit a hyperlink to the browser in the first place. This
also can be accomplished in your ItemTempate:
<asp:HyperLin k runat="server" Text="Something "
NavigateUrl='Ot herPage.aspx?Em pID=<%# DataBinder.Eval (Container.Data Item,
"employee_i d") %>'></asp:HyperLink>
-Brock
DevelopMentor http://staff.develop.com/ballen Well, suppose i have couple of controls in datalist and one of them is link button control
how do i invoke link button controls click method in the datalist ???
Suppose link button control will send info back to server and redirect to another page, how do i do it in datalist ?
I have following code in item templatae <asp:LinkButt on id="Linkbutton1 " OnClick="OnClic kMethod" runat="server"> Download Chapter</asp:LinkButton> I want to be able to pass arguement to OnClickMethod [the arguement is employee_id which comes from the table]
Something like when link button is clicked, it'll redirect to another page containing employee details.
Thanks
"Brock Allen" <ba****@develop .com.i_hate_spa m_too> wrote in message
news:78******** *************@m snews.microsoft .com... In your ItemTemplate make the LinkButton have a CommandName="Do Something". On your Datalist specify the primary key for the rows via the DataKeyField="e mployee_id" attribute. Then handle the DataList's ItemCommand event to do something like this:
protected void _dataList_ItemC ommand(object source, DataListCommand EventArgs e) { if (e.CommandName == "DoSomethin g") { int employee_id = (int)_dataList. DataKeys[e.Item.ItemInde x]; // now do something with } }
But if your going to do all of this simply for a redirect, then it's much simpler to just emit a hyperlink to the browser in the first place. This also can be accomplished in your ItemTempate:
<asp:HyperLin k runat="server" Text="Something " NavigateUrl='Ot herPage.aspx?Em pID=<%# DataBinder.Eval (Container.Data Item, "employee_i d") %>'></asp:HyperLink>
-Brock DevelopMentor http://staff.develop.com/ballen Well, suppose i have couple of controls in datalist and one of them is link button control
how do i invoke link button controls click method in the datalist ???
Suppose link button control will send info back to server and redirect to another page, how do i do it in datalist ?
I have following code in item templatae <asp:LinkButt on id="Linkbutton1 " OnClick="OnClic kMethod" runat="server"> Download Chapter</asp:LinkButton> I want to be able to pass arguement to OnClickMethod [the arguement is employee_id which comes from the table]
Something like when link button is clicked, it'll redirect to another page containing employee details. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Antonio D'Ottavio |
last post by:
Good Morning,
In my web page I've a datalist that is sourced by a database,
the problem is that I want that one of the column of the datalist contain a
dropdownbox
that also is sourced by a table in the database.
<asp:DropDownList id="ComboTipoPartita" runat="server"
DataValueField="IDTipoPartita"
DataTextField="DescrizioneTipoPartita"
DataSource="<% BindComboTipoPartita() %>"
|
by: V. Jenks |
last post by:
What seems like a simple thing is apparently not so
straightforward?
I have a datalist.
Inside of that datalist is an <itemtemplate> secion which
contains other server controls such as a label, a
radiobuttonlist, etc.
I'm driving myself insane trying to figure out how to get
|
by: Bharat |
last post by:
Hi Folks,
Suppose I have two link button on a page (say lnkBtn1 and
lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically
created control. And On the click event of the lnkBtn2 I have to add a
datalist control.
Using this datalist control I should be able to add edit, modify
and cancel the items listed in this control.
Here is how I designed. I used placeholder to add the controls dynamically
to the page on the click...
|
by: Glenn Owens |
last post by:
Here's the scenario:
I have a DataList populated from a datatable sitting inside a
fieldset. Each element (row) in the Datalist has the following child
controls: asp:checkbox, asp:image, asp:labels.
Within the <form>, but outside the fieldset, containing the datatlist,
I have a usercontrol (used to collect search criteria) and some
asp:button controls (used to initiate actions - ie. retrieve db data,
reset user control fields,...
|
by: Olav Tollefsen |
last post by:
I have a Web Form with a DataList. Inside the ItemTemplate, I have a
DropDownList control.
<asp:DataList ID="ProductDataList" Runat="server">
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" Runat="server"
DataTextField="PropertyValue" DataValueField="PropertyValueId">
</asp:DropDownList>
</ItemTemplate>
</asp:DataList>
| |
by: Paul |
last post by:
I am trying to use a DataList and the ItemTemplate.
I am binding the Datalist to a SQL query that gives me a list of Items with
a Parent Category.
I want to loop through all the items, but only print the Parent Category
once, regardless of how many child items are in it.
So my perfect output would look something like:
|
by: Mirek Endys |
last post by:
I have DataList as part of DataList item. DataList in DataList. The parent
DataList working well including Edit command, that shows Edit template and
correctly bind the data into edit template (where is the child DataList)....
But in case I want to make Edit in this child DataList it is not working...
No edit template showed... :(
this is a code that i use for the child DataList... Edit command
// this is for child DataList...
|
by: Les Caudle |
last post by:
I have a menu system composed of a DataList nested inside a DataList.
The outer DataList has it's DataSource (composed of a DataSet with two tables
linked by a CategoryPagesRelation Relation) set in the Page_Load.
The inner DataList has its DataSource set in the ascx file as:
<asp:DataList ID="PageList" runat="server" CellPadding="3" CellSpacing="0"
DataSource='<%#...
|
by: scottls |
last post by:
Hi All,
Thanks for reading my post. I have been working on getting nested
datalists working properly wihtin my framework for many days and I
think I'm almost there. See if you could help me get over the hump
here.
Some of our products come in different sizes - i.e. what I call
"units". Some products don't. I successfully created the first
datalist (called productList) to show our products with their general
|
by: Jim in Arizona |
last post by:
I'm don't know how I would get around this.
When working with a datalist control, there a specific built in commands
(OnEditCommand, OnCancelCommand, etc). These commands, when the datalist
control is made, refer to a subprocedure (eg:
OnUpdateCommand="MyUpdateProcedure").
When referring to a specific record that's written to the page by the
datalist object, it refers to the datakey (eg: <asp:datalist
datakeyfield="ID" ...>). Then...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |