Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Saturday, March 24, 2012

Newbie Grid Question

Let me explain my situation ...
I have a grid with databound columns, which are filled at run time. I
need to add an onlick event to the link button header that will fire a
vb.net sub procedure. This sub procedure will need to be passed the
data field name which is used to fill the column clicked. The data
fields and link button header names are all determined and filled at
run time.
I want to add the onclick event by calling the attributes.add method
when the column is created. My question is, where do I put this
attributes.add method where I will have access to the data field
name? I dont want to do it on the row created event and I dont think
i have access to the columns in the grid databound event. Can anyone
point me in the right direction? I think I may be doing this
incorrectly.
Thanks so muchOn Feb 27, 1:12 pm, "mianiro" <mian...@.gmail.com> wrote:
> Let me explain my situation ...
> I have a grid with databound columns, which are filled at run time. I
> need to add an onlick event to the link button header that will fire a
> vb.net sub procedure. This sub procedure will need to be passed the
> data field name which is used to fill the column clicked. The data
> fields and link button header names are all determined and filled at
> run time.
> I want to add the onclick event by calling the attributes.add method
> when the column is created. My question is, where do I put this
> attributes.add method where I will have access to the data field
> name? I dont want to do it on the row created event and I dont think
> i have access to the columns in the grid databound event. Can anyone
> point me in the right direction? I think I may be doing this
> incorrectly.
> Thanks so much
Ok, so i figued out where to put it. My problem now is how can i get
the data field name used to populate that column'
grid.columns(0).'

Newbie Grid Question

Let me explain my situation ...

I have a grid with databound columns, which are filled at run time. I
need to add an onlick event to the link button header that will fire a
vb.net sub procedure. This sub procedure will need to be passed the
data field name which is used to fill the column clicked. The data
fields and link button header names are all determined and filled at
run time.

I want to add the onclick event by calling the attributes.add method
when the column is created. My question is, where do I put this
attributes.add method where I will have access to the data field
name? I dont want to do it on the row created event and I dont think
i have access to the columns in the grid databound event. Can anyone
point me in the right direction? I think I may be doing this
incorrectly.

Thanks so muchOn Feb 27, 1:12 pm, "mianiro" <mian...@.gmail.comwrote:

Quote:

Originally Posted by

Let me explain my situation ...
>
I have a grid with databound columns, which are filled at run time. I
need to add an onlick event to the link button header that will fire a
vb.net sub procedure. This sub procedure will need to be passed the
data field name which is used to fill the column clicked. The data
fields and link button header names are all determined and filled at
run time.
>
I want to add the onclick event by calling the attributes.add method
when the column is created. My question is, where do I put this
attributes.add method where I will have access to the data field
name? I dont want to do it on the row created event and I dont think
i have access to the columns in the grid databound event. Can anyone
point me in the right direction? I think I may be doing this
incorrectly.
>
Thanks so much


Ok, so i figued out where to put it. My problem now is how can i get
the data field name used to populate that column??
grid.columns(0).??

NEWBIE HELP

Hi All

I have a web form that uses an object class to populate a standard table (not datagrid etc)

I have a button on this form that when clicked opens another form for editing. In this form all the values of the object are used to populate text boxes (in the load event of the form there is a call to a DBHelper class which uses a SQL Parameter Array to execute a strored procedure (SQL) and return the data) and text areas which are free to edit in this form.

Also on this page I have a button called save changes which when clicked I am attempting to create a new paramater array to execute an update procedure again using the DBHelper Class.

Unfortunately when I try to do this the values in the new SQLParamater Array are exactly the same as before and are not reflecting the changes that I make by typing new entries into the text boxes on the form. As a newbie to .net I am lost here and realise that this is probably a scope or state problem but I would like someone to point me in the right direction please. When I hard wire the new SQLParamater Array the update does work so that eliminates the chances of the DBHelper Class from any fault.

Please help as I am going bonkers here!!!!!

Phill

You probably have your "populate form" bit in your Page Load function - which will execute when the save button causes a post back.

Surround your "populate the textboxes" code with:

if (!IsPostBack)
{

...

}

This will mean it only runs when the page is first loaded.


Have you looked if your sql update statement is passing the values as @.new_value

I would recommend doing this on a datagrid, it would be easier to update cuz the datagrid already has an update command field!


I cant use a datagrid as the recordset only ever returns one row with 17 fields. Datagrids need multirows to work dont they?


Datagrids work with "a number" of rows - that can be one row.


welshpunk:

I cant use a datagrid as the recordset only ever returns one row with 17 fields. Datagrids need multirows to work dont they?

Hi welshpunk,

Try to follow those codes as follows:

Working with a Single Table
http://msdn2.microsoft.com/en-us/library/aa719548(VS.71).aspx

Thanks.


Yes but you cannot turn a datagrid on its side. I have 17 fields in the recordset(just one row) Using a datagrid in this fashion is not user friendly as some of the fields are up to 2000 chars long. Datagrids will display like this

Column Heading Column Heading Column Heading Column Heading Column Heading

Data Data Data Data Data

I want to display the data in a more user friendly way like this

Column Header Data

Column Header Data

Column Header Data

Column Header Data

Column Header Data

Column Header Data

Column Header Data

With the 17 column headers on the left and their respective data adjacent to them. This is why I had to create the form in this way.


Hi,

You can write each cell every time by reading each cell once.

Hope this helps.


I have already marked as answer


Don't worry - you'll soon see that comment about marking posts as the answer absolutely everywhere!


You could try using a detailsview. The data would be displayed the way you want.

Newbie Help

I have a listbox on my page and i add data to it everytime a button is pressed.

however each time the button is clicked it adds the page to the list of pages in the back button.
so if i press the button 7 times there will be 7 pages under the back button

How can i stop this from happening?Might help if we see a little code.

But sounds to me if the listbox is also getting information from the database, you need to clear the box first.

myListBox.Items.Clear()

Then add everthing to it again, including the new entry.

Zath
what i have is a user enter data into a textfield.
They then hit add and the textfields data is added to the listbox.
I do this several times
Each time i do it if i go to the back button on the web browser it will have a page in it for each
entry.

Can this be fixed with ispostback.
Common - and still a problem
check out this article
http://stevenbey.co.uk/detectingPageRefresh.aspx

HTH
Hi,

Dino Esposito has also written a page refresh detection mechanism last year. Check it out at:Build Your ASP.NET Pages on a Richer Bedrock.

Grz, Kris.

Friday, March 16, 2012

newbie postback question about ASP controls

Do I understand correctly that my aspx webpage's DataGrid, Button and web
control states are somehow stored in the "_VIEWSTATE" hidden input value,
making it unneccesary to recreate their content in the case of page
postbacks? Or are there gotchas I need to look out for in assuming these
controls will work correctly, and have their former values available, after
a postback?
Thanks,
JimHi Jim,
You are correct for your server controls. The ones that start <asp:...>.
You can also add your HTML control to the _VIEWSTATE by giving them the
runat="Server" attribute. For example: <input type="hidden" id="hidValue"
runat="server"> will add this control to view state and it will retain its
value between postbacks. Good luck! Ken.
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
"Jim Bancroft" <bobgambles@.nowhere.com> wrote in message
news:epGzj$koEHA.3668@.TK2MSFTNGP15.phx.gbl...
> Do I understand correctly that my aspx webpage's DataGrid, Button and web
> control states are somehow stored in the "_VIEWSTATE" hidden input value,
> making it unneccesary to recreate their content in the case of page
> postbacks? Or are there gotchas I need to look out for in assuming these
> controls will work correctly, and have their former values available,
after
> a postback?
> Thanks,
> Jim
>
Thanks for the explanation and help, Ken! Good stuff below.
-Jim
"Ken Dopierala Jr." <kdopierala2@.wi.rr.com> wrote in message
news:%23FEbSHloEHA.2864@.TK2MSFTNGP12.phx.gbl...
> Hi Jim,
> You are correct for your server controls. The ones that start <asp:...>.
> You can also add your HTML control to the _VIEWSTATE by giving them the
> runat="Server" attribute. For example: <input type="hidden"
id="hidValue"
> runat="server"> will add this control to view state and it will retain its
> value between postbacks. Good luck! Ken.
> --