473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to get value from databind

121 100+
hi,
i have repeater with feild id bound to it.
ex.
Expand|Select|Wrap|Line Numbers
  1. <td><asp:LinkButton Runat="server" ID="lnkDelete" CommandName="DeleteMe" 
  2.                     CommandArgument='<%# DataBinder.Eval(Container,"DataItem.Id") %>' >Delete</asp:LinkButton></td>
now in .cs file when i click on delete button, i m passing this id to sql and deleting the record.
.

in .cs what i have done is..

Expand|Select|Wrap|Line Numbers
  1. protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
  2.         {
  3.             int JID = Convert.ToInt32(CryptWrapper.decode(Request.QueryString["vID"]));
  4.             string linkid = Convert.ToString(e.CommandArgument);
  5.             int id = Convert.ToInt32(linkid);
  6.             EstateAgentsCollection es = new EstateAgentsCollection();
  7.             es.Delete(JID,id);
  8.             Repeater1.DataSource=es;
  9.             Repeater1.DataBind();
  10.  
  11.         }
i m unable to retreive that linkid..

any help with code will be appreciated
Sep 10 '08 #1
2 1425
nateraaaa
663 Expert 512MB
Try adding this to your ItemCommand event

Expand|Select|Wrap|Line Numbers
  1. if(e.CommandName == "DeleteMe")
  2. {
  3.  int JID = Convert.ToInt32(CryptWrapper.decode(Request.QueryS  tring["vID"]));
  4.  int linkid = Convert.ToInt32(e.CommandArgument);
  5.  EstateAgentsCollection es = new EstateAgentsCollection();
  6.  es.Delete(JID,linkid );
  7.  Repeater1.DataSource=es;
  8.  Repeater1.DataBind();
  9. }
Nathan
Sep 10 '08 #2
jay123
121 100+
Try adding this to your ItemCommand event

Expand|Select|Wrap|Line Numbers
  1. if(e.CommandName == "DeleteMe")
  2. {
  3.  int JID = Convert.ToInt32(CryptWrapper.decode(Request.QueryS  tring["vID"]));
  4.  int linkid = Convert.ToInt32(e.CommandArgument);
  5.  EstateAgentsCollection es = new EstateAgentsCollection();
  6.  es.Delete(JID,linkid );
  7.  Repeater1.DataSource=es;
  8.  Repeater1.DataBind();
  9. }
Nathan
thanks nathan i worked.
Sep 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: DC Gringo | last post by:
I've got a command button to submit a value from a dropdown list that should then filter a SELECT query. I'm simply appending a WHERE colx = <variableSelectedFromDropdownList>. How do I pass this...
5
by: DC Gringo | last post by:
I have a dropdownlist that, upon form submission, I'd like to maintain the selected value when I get my result...how do I do that? <asp:dropdownlist Font-Size="8" id="ddlCommunities"...
3
by: Stephan | last post by:
Hi, I'm working on a page with multiple Datalist-controls on it. The problem I'm facing is that when I try to update a record, the ItemIndex returns a value which is one lower than the Item I...
1
by: Stu Lock | last post by:
Hi, Is there any way to databind a hashtable to a drop down list box using the key/value pair within the hashtable to correspond to the value/text of the drop down list box? ie: hashtable...
3
by: Stephen Adam | last post by:
Hi there, I'm sure i'm missing something really simple here, all i want to do is get the value of the selected item in a list box. Even after much fiddling about last night I still could not get...
2
by: HH | last post by:
Hi, I have a dropdown list that is datafilled via a SQL table. The text part is always unique. (A list of countries) Each country is assigned one of three numbers. (This being the 'value' of...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
8
by: Andy B | last post by:
I have the object property StockContract.Dictionary which is a dictionary collection of <string, stringkey/value pairs. I need to be able to retreive the keys and their values and display them on a...
3
by: John | last post by:
I have two dropdown lists that I have bound to a datatable and set the DataTextField and DataValueField for. Both lists show the values I expect from the database. However, when I need to access...
6
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.