.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How can I change values in mydetailsview_ ItemInserting event

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net
I'm inserting values with detailsview, and I want to modify one of my values and my client should not see it.

This is my detailsview:

<asp:DetailsView ID="dv_InsertTaps" Runat="server" DataSourceID="ds_InsertTaps" DataKeyNames="TapId"
AutoGenerateRows="False" DefaultMode="Insert" title="INSERTAR TAPS" OnItemInserting="dv_InsertTaps_ItemInserting">
<asp:TemplateField SortExpression="TapNumero" HeaderText="N&#186; Tap"><InsertItemTemplate>
<asp:TextBox Runat="server" Text='<%# Bind("TapNumero") %>' ID="tb_TapNumero"></asp:TextBox>
<asp:BoundField HeaderText="Valor" DataField="TapValor" SortExpression="TapValor"></asp:BoundField>
<asp:BoundField HeaderText="Alta Frecuencia" DataField="TapAF" SortExpression="TapAF"></asp:BoundField>
<asp:BoundField HeaderText="Baja Frecuencia" DataField="TapBF" SortExpression="TapBF&quo

View Complete Post

More Related Resource Links

Can't change Gridview row colors or styles in the DataBound event


I was highlighting certain rows in my gridview using code like this in the DataBound event:

        if (e.Row.RowType == DataControlRowType.DataRow)
            int vendorCheck = 0;
            //TODO make this shorter
            if (DataBinder.Eval(e.Row.DataItem, "vendorId") != System.DBNull.Value)

how do i use javascript to change values of controls inside a gridview

i have 2 labels (lblRate,lblTotal) and a textbox (txtQuantity) in a itemtemplate of a gridview.I want to calculate the products of rate and quantity and show it in Total as the textbox loses focus...i cant use textchanged because i dont want the page to postback.How do i use javascript to achieve this??Please Help Urgently....<asp:TemplateField HeaderText="Rate">                <ItemTemplate>                    <asp:Label ID="lblRate" runat="server" Text='<%# Eval("Rate") %>' />                </ItemTemplate>            </asp:TemplateField> <asp:TemplateField HeaderText="Quantity">                <ItemTemplate>                    <asp:TextBox ID="txtQty" runat="server" />                </ItemTemplate>&

how to get values of list item being entered in ItemAdding event handler?

Hi,          i am trying to get the values being entered in a listitem in the ItemAdding eventhandler as follows, but it doesnt work. public override void ItemAdding(SPItemEventProperties properties)         {             base.ItemAdding(properties);             SPSite CurrentSite = new SPSite("http://mm-moss/np/");             SPWeb CurrentWeb = properties.OpenWeb();             SPList CurrentList = CurrentWeb.Lists[properties.ListId];             string vehicleNo = CurrentList.Items[CurrentList.Items.Count - 1]["Vehicle No"].ToString();             string  name=CurrentList.Items[CurrentList.Items.Count-1]["Name"].ToString(); } when i debug i cant get hold of the VehicleNo value. canyone help me in getting the values of the list item being entered? Thank you all.

Trap Selected Index change event of listbox using Javascript.

Hi All, This is reagarding listbox selection. I have a list box with multi select option. I want to trap the selected index change event of Listbox through javascript. Item of list box can be selected using Click of mouse and also the keyboard up down key with shift. I tried onclick event to bind the javascript function. It works fine if I select by mouse, but it doesen't work for up/down key of keyboard. Thanks, Naveen

Gridview RowCommand Event returning null values

HiI'm trying to retreive values entered by users in the textboxes in the footer of the gridview and insert these values into another sql table.My code is as follows :-protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)    {       if(e.CommandName.Equals("addnew"))       {                       TextBox t1 = (TextBox)GridView2.FooterRow.FindControl("tfrm");            string frm = t1.Text;            TextBox t2 = (TextBox)GridView2.FooterRow.FindControl("tsub");            string sub = t2.Text;            string cmd = "insert into suggestions values('" + frm + "','" + sub + "','c','c')";            con.Open();            SqlCommand com = new SqlCommand(cmd,con);            int a = com.ExecuteNonQuery();&n

show value in label on textbox change event

I want to show value in label on textbox change event , means when user enter text in text box then this value should display in label  . I am using this:<asp:UpdatePanel ID="UpdatePanel1" runat="server">    <ContentTemplate>     <asp:TextBox ID="TextBox5" runat="server" ontextchanged="TextBox5_TextChanged" AutoPostBack="true"></asp:TextBox>    </ContentTemplate>    </asp:UpdatePanel>========================================================protected void TextBox5_TextChanged(object sender, EventArgs e)     {         ViewState["xyz"] = Convert.ToInt32(TextBox4.Text) - Convert.ToInt32(TextBox5.Text);         ViewState["xyz1"] = Convert.ToInt32(ViewState["xyz"].ToString()) * 100;         lbldiff.Text = ViewState["xyz"].ToString();         lblprofit.Text = ViewState["xyz1"].ToString();     }protected void TextBox5_TextChanged(object sender, EventArgs e)    {        ViewState["xyz"] = Convert.ToInt32(TextBox4.Text) - Convert.ToInt32(TextBox5.Text);        ViewState["xyz1

bind values for the drop down based on people picker value change

hi, i have a two lists in my sp. list 1 name  items user1 item1 user1 item2 user2 item1   and list 2 is in this way in this i have a people picker and a drop down when ever i change the name in people picker the value should get filled from list 1 and fill in drop down list so i need to get the on text changed event of people picker and bind it in the dropdown list could some help me out in fixing thisjayaraja

CheckBoxList in UpdatePanel won't change values

Hello all.  I have a CheckBoxList that contains the days of the week.  If I use standard asp.net with AutoPostBack = true, everything works fine.  However, I would like to not have post backs everytime a user selects a day, so I'm trying to get the control to update using Atlas.  Here is the code (note: I put in the asteriks to bypass the filters on this website):  <*atlas:UpdatePanel ID="validDaysUpdatePanel" runat="server" Mode="Always"> <*ContentTemplate> <*asp:CheckBoxList ID="cblValidDays" runat="server" CssClass="inputfields" RepeatDirection="Horizontal" AutoPostBack="True" OnSelectedIndexChanged="cblValidDays_SelectedIndexChanged" > <*asp:ListItem Text="All" Selected="True"><*/asp:ListItem> <*asp:ListItem Text="Sun" Value="1"><*/asp:ListItem> <*asp:ListItem Text="Mon" Value="2"><*/asp:ListItem> <*asp:ListItem Text="Wed" Value="4"><*/asp:ListItem> <*asp:ListItem Text="Thu" Value="5"><*/asp:ListItem> <*asp:ListItem Text="Fri" Value="6"><*/asp:ListItem> <*asp:ListItem Text="Sat" Value="7"><*/asp:ListItem> <*/asp:CheckBoxList> <*/ContentTemplate> <*Triggers> <*atlas:ControlEventTrigger ControlID="cblValidDays" EventName="SelectedIndexChanged" /> <*/Triggers> <*/atlas:Upd

bind values for the drop down based on people picker value change

hi, i have a two lists in my sp. list 1 name  items user1 item1 user1 item2 user2 item1   and list 2 is in this way in this i have a people picker and a drop down when ever i change the name in people picker the value should get filled from list 1 and fill in drop down list so i need to get the on text changed event of people picker and bind it in the dropdown list could some help me out in fixing thisjayaraja

Drop Down Listbox SelectedIndexChanged Event not firing when I programmatically change selection

I have two drop down listboxes (DDL1 and DDL2).  When DDL1 has an index change, DDL2 then has a refresh of list items based off SQL Server SELECT from a table.  The database isn't the problem.  Everything works perfectly when the user selects a new item manually from DDL1.But in my code, I save the user data from the selection of DDL1 in a separate table.  And then upon rendering of the page (Page_PreRenderComplete), I do a SelectedIndex assignment of the value of what's saved in the db table.  That works just fine, it selects the DDL1 item, but DDL2 is unaffected, as if DDL1's SelectedIndexChanged event isn't called like it would be if manually changed.  How can I get around this?Thanks in advance. :)

How to Capture a DropDownList Selected Index Change Event

I have a gridview that receives data based on selection from a primary dropdownlist object. Works. Within the gridview, there is a dropdownlist whose selected index is based on the query from the primary dropdownlist. Works. Problem. How do I force the used to  change whatever value that the dropdownlist contains after they make their initial selection from the primary dropdownlist; except the default value of "Please make a selection". Gridview, contains a checkbox which drives whether a selected row is inserted into the data base. The databind in done using an ObjectDataSource on the presentation page, not in the code behind.   Thank you.   Ayomide 

disable a single intem in dropdownlist or stop the ddl change event for a single item


hello guys,

I am trying something apart of my boundries, is there any way to disable a single intem in dropdownlist or stop the ddl change event for a single item.

any feadback would be appriciable.

Thanks and Regards

Inderjeet Singh Khalsa

Change row values in report before rendering


I have a detail section in report. I am perfectly able to retrieve all the data from the Sharepoint List into datatable and bind it, to generate reports inside the details section.
All the columns and related row data are getting displayed as reports in to the detail section.
But, my issue is, I want to change the row data for a particular column before rendering on to the report.

for instace, if column named Product has some values, I would like to display these values with different string name based on a switch condition. How do I achieve this?

spgridview RowDataBound event returning cell values as empty


i am working with SPGridView to display Announcements. User should be able to edit his own created Announcements.Remaining Items shouldnt be having edit option.

i created SPGridView Columns :

                SPBoundField Title = new SPBoundField();
                Title.HeaderText = "Title";
                Title.HeaderStyle.Font.Bold = true;
                Title.DataField = "Title";

                SPBoundField Description = new SPBoundField();
                Description.HeaderText = "Description";
                Description.DataField = "Description";


Send values to parent window on gridview click event


Hello all,

I have a form, which contains 2 textboxes. When i click on the first textbox, i have to open a child window (tool), that contains a gridview control with 2 columns (corresponding to the 2 textboxes). When the user clicks on any row in the gridview, it should send back the 2 column values back to the parent window to the corresponding 2 textboxes. Can anyone help me on how do i achieve this?

I can open the child window and get back the values using window.opener method in JS. 

But can anyone help on how to bind the JS code to the onClick of every row in the gridview. How can i activate the OnClick event of every row/alternating row item of the gridview and bind the JS code and pass each column value to that JS method? The no of columns in the gridview can vary depending upon the data? So in that case, i have to have a collection to be passed to JS code that can contain n number of column values.

Please help.

Unable to change textbox values after manual assignment



In my webapp, I have a DropDownList_OnSelectedIndexChanged that assigns values for a number of <asp:textbox'es depending on which entry is selected...

       public void ModifyProjectIDBox_SelectedIndexChanged(object sender, EventArgs e)


            int tempJobID = Get_Selected_Report();

            dbCommandString = "SELECT Name, Address, State, Awarded, StartDate, EndDate, HomeLocal FROM dbo.ProjectInfo WHERE ProjID = " + tempJobID;

            dbComm.CommandText = dbCommandString;


            dbReader = dbComm.ExecuteReader();


                ModifyProjectNameBox.Text = dbReader[0].ToString();


            ModifyProjectAddrBox.Text = dbReader[1].ToString();

            ModifyProjectStateBox.Text = dbReader[2].ToString();


Simplest way to get a month change event on WPF Calendar (.net 4.0)



is there a simple way to receive some event as soon as someone turns the wpf calendar to the next or previous month?

The calendar is used as a user control part. (If this info is necessary)

At least i tried to handle this over some code via "DependencyProperty" to access the contend and the changed event of the "PART_Header...".

Unfortunately that won't solve my case.

Best regards,


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend