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


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Getting the headertext of a selected column when autopostback = true

Posted By:      Posted Date: September 23, 2010    Points: 0   Category :ASP.Net
 

Hi All,

I have a grid which is getting bound from a dataset and the autogeneratecolumns prperty is set to true.

Now i have a menu control. And when i select a particular cell, I want to headertext of the cell selected should appear as the text of the menu item.

But because autogeneratecolumns = true, so i gridview.columns.count=0. So not able to get the header text.

The code goes as follows.

If selectedColumnIndex > 4 Then
                menuBSDet.Items(0).ChildItems(menuDetail.RemoveDetValues).Enabled = True
                menuBSDet.Items(0).ChildItems(menuDetail.RemoveDetValues).Text = "Remove " & gvwBSDetails.Columns(selectedColumnIndex).HeaderText
            Else...


 

Can somebody please help?




View Complete Post


More Related Resource Links

Rendering data with HTML tags in the DD Gridview for a selected column

  

I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

It seems gridView1.HtmlEncode = true has gone away.

So maybe I'll try to catch it on the RowDataBound event:

protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // Html Encode the cells
            }

        }

but this event never fires?


Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!


How To Access Datakeys In Javascript...and How To make gridview Column Visible true in javascript

  

How To Access Gridview's Datakeys In Javascript...and How To make gridview Column Visible true in javascript



Reply me..


Configure BDC column to have multiple values selected

  

How do I Configure BDC column to have multiple values selected and make multiple entities data available in the same column.  Currently it supports only single value for an item.  This requirement is crucial need some solution immediately.


sum of only selected column in matrix

  
i have a simple matrix where is display yearly sales: i want to show avg_1_year, avg_2_year, which uses the formula : yearly amount / number of month... for avg_1_year: 2010 amount / 8 (since we are in august).. customer       2010      2009    2008 2007  avg_1_year  avg_2_year  A                    500     200      200  200      500/8         (500+200)/20 i dont know how to get values of 2010 for avg_1_year and of 2010+2009 for avg_2_year

Dropdownlist not firing SelectedIndexChanged on first item with autopostback true

  
Hi: Has anyone ever found a work around for the well documented and well known bug, the dropdownlist bug? Specifically where the SelectedIndexChange event does not fire on the first listitem, althought both autopostback and enableviewstate are true? In other words, if the first three items in the dropdownlist are red, blue, green, if you select green, the SelectedIndexChanged will fire, but if you then select red, the first item in the ddl, the event will not fire. All listitems will fire the SelectedIndexChanged event, except for the very first listitem. The HACK has always been to include a dummy item as the first list time like"Select a Color" to get around the first item bug. I have got a situation where I cannot use that hack. Ideas?  TIA, Bill  

Can I customize column headers with autogeneratefields = true?

  

If my SQL column is UnitPrice, that's how it shows up in my templates. ok fine.

Now is there a way to customize the column header so it says "Unit Price" without changing AutoGenerateColumns to false & recreating the header & columns myself?

And if not, how can I modify the Edit.aspx fields? It was no problem with the gridview, but form view seems a little different.

 

Thanks for the help!!


How to sum selected matrix column in SSRS

  

anybody can help me to solve my problem??

i have a matrix report and i want to calculate just column 1 and column 3...

So any idea to solve my problem?

Thanks before :)

 

Gbu.....


Problems with AJAX slider and autopostback=true ?

  

I have three AJAX sliders and each has a:

<asp:AsyncPostBackTrigger ControlID="Slider1" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="Slider2" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="Slider3" EventName="TextChanged" />


When I do a TextChanged event on slider1 (by dragging the slider, changing the value), the protected void Slider1_TextChanged(object sender, EventArgs e) event FIRES,  however, the TWO other sliders, protected void Slider2_TextChange, and protected void Slider3_TextChange  also FIRES.  What gives?  why do they fire when I am physically only sliding the slider1 across.  The two other sliders values did not change on the webform, yet the event fired.


In order for the event to fire for slider1, I had to insert "Autopostback=true" in the <asp:TextBox ID="Slider1" autopostback="true" OnTextChanged="Slider1_TextChanged">.  For <asp:TextBox2> and <asp:Textbox3> I did not put the autopostback event for now.


thanks!!!


how to hide a column in a datagrid but autogenerated columns = "True"?

  

Hi,

  Anybody help me please!!! I've 3 datasets named ds1, ds2, ds3. Then i merged that 3 datasets into 1 datatable named dt1. Now, my question is, i want to hide some datacolumns its present in an ds2. How????? Below i attached my code,

string

 

connectionString = "provider=MSDAORA;data source=proact;user id=mah;password=mah";

 

OleDbConnection myOleDbConnection = new OleDbConnection(connectionString);

 

Cascading dropdown not posting back even though autopostback=true?

  

I have the following code:

.aspx
<asp:DropDownList ID="ddlCountries" AutoPostBack="true" runat="server">
</asp:DropDownList>
<cc1:cascadingdropdown ID="cddCountries" runat="server" Category="Country" Enabled="True" LoadingText="loading" PromptText="choose country"
    ServiceMethod="GetCountries" ServicePath="geolocation.asmx" TargetControlID="ddlCountries">
</cc1:cascadingdropdown>


code behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    ShowSearchResults()
End Sub

Private Sub ShowSearchResults()

End Sub


Why is the ShowSearchResults method not called when I change a value in the ddlCountries dropdown, even though I have autopostback="true" on it.


Custom Columns - Fill values based on value selected in a lookup column

  

Hello,

I am working with Sharepoint 2007. I have a list of 130 buildings located in six different cities and three different provinces. I imported this list from an Excel spreadsheet. I also have a document library that contains various files associated with these buildings. I've added a custom column to the document library that contains a lookup field to the name of each building. I also have two additional custom columns that have the city and province. What I would like to accomplish is to have the city and province columns automatically be set based on the name of the building selected, such that these values are taken from the same row of this list as the building name.

Hopefully my question makes sense.

Thank you, James


Required Validator disappears after autopostback set to true of a dropdownlist

  

My dropdownlist having data from database added with the following item:

DropDownList.Items.Insert(0, new ListItem("Please select", "0"));

My dropdownlist is inside of updatepanel. The autopostback=true is required.

The code is like following:

<asp:DropDownList ID="DropDownList" AppendDataBoundItems="True" runat="server"
                  DataTextField="Description" DataValueField="CommonCodeId" TabIndex="4" 
                    CssClass="drop_red_style1" AutoPostBack="True" CausesValidation="True" 
                     OnSelectedIndexChanged="DropDownList_SelectedIndexChanged">
                </asp:DropDownList>

<asp:RequiredFieldValidator ID="RequiredFieldValidator" runat="server" ControlToValidate="DropDownList"
                    Display="Dynamic" InitialValue="0" SetFocusOnError="true" ValidationGroup="Registration">Required</asp:RequiredFieldValidator>
Please guide me how to keep the required field validator message.


Required Validator disappears after autopostback set to true of a dropdownlist

  

My dropdownlist having data from database added with the following item:

 

DropDownList.Items.Insert(0, new ListItem("Please select", "0"));

 

My dropdownlist is inside of updatepanel. The autopostback=true is required.

The code is like following:

<asp:DropDownList ID="DropDownList" AppendDataBoundItems="True" runat="server"
DataTextField="Description" DataValueField="CommonCodeId" TabIndex="4"
CssClass="drop_red_style1" AutoPostBack="True" CausesValidation="True"
OnSelectedIndexChanged="DropDownList_SelectedIndexChanged">
</asp:DropDownList>

<asp:RequiredFieldValidator ID="RequiredFieldValidator" runat="server" ControlToValidate="DropDownList"
Display="Dynamic" InitialValue="0" SetFocusOnError="true" ValidationGroup="Registration">Required</asp:RequiredFieldValidator>
Please guide me how to keep the required fie

Comparing Selected value against GridView Column

  

Hello,

             I have a GridView Column "Gender". After displaying datagrid, I m selecting dropdown which is not in datagrid.

Dropdown list is in the same page. When I select dropdown Gender as male or female, I have to validate that Gender against GridView Column. If that Gender Exist in GridView, I have to display message.


TIA


SSRS report export to CSV showing column headers always in English inspite of the selected locale.

  

We are encoutering an issue with SSRS report export to CSV showing column headers always in English, regardless of locale.

 

We are using SSRS to display report results in a report viewer window launched from an ASP.net page.

 

When the report viewer is lauched in fr-CA locale, the report viewer window content is in French. However, when the results are exported to CSV, all the column header labels inside the CSV are always in English.

 

How can I customized the column header when set AutoGenerateColumn =true

  

If I set the AutoGenerateColumn property to true in WPF datagrid.

How can I customized the column header ?

 I do not want the datagrid display the data object name ,I 'd like to display a friendly name .

 How can I do that ?

Thanks.


Beat Microsoft.

Dropdownlist AutoPostBack="true" NOT Firing in IPhone

  

Hi everyone,

This is really weird...I have a ASP.NET page for mobile view.

On that page I have this part:

<td><asp:DropDownList ID="DropDownLocation" runat="server" AutoPostBack="true" OnSelectedIndexChanged="test" 
                            appenddatabounditems="True" style=" font-size:large; vertical-align:middle;" Width="170px">
                    <asp:ListItem value="Houston">Houston</asp:ListItem>
                    <asp:ListItem value="El Paso">El Paso</asp:ListItem>
                    <asp:ListItem value="Austin">Austin</asp:ListItem>
                    <asp:ListItem value="Boise">Boise</asp:ListItem>
                    <asp:ListItem value="Washington">Washington</asp:ListItem>
            </asp:DropDownList>

While testing this on normal computer using IE7 IE8 it fires the AutoPostBack Control.

BUT TESTING IN IPHONE THIS DOES NOT FIRES....

ALSO THE DISPLAY IS WIERD BECAUSE A SEPARATE BOX APPEARS AT THE BOTTOM TO SELECT THE LIST.

What am I doing wrong?

Thank you in advance!

 

 


Categories: 
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