|
in my project i need tomake a grid thrugh i can enter record to store
so i need to add new row at run time in grid view
so how too do it
Raghvendra
|
|
|
|
|
This is one way. This example adds an empty row in the gridview
Private Sub GridView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PreRender
Dim GV As GridView = CType(sender, GridView)
Dim Tbl As Table = CType(GV.Controls(0), Table)
Tbl.Controls.AddAt(index, AddEmptyRow)
End Sub
Function AddEmptyRow() As GridViewRow
Dim GVR As GridViewRow = New GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal)
Dim cell As TableCell = New TableCell
cell.ColumnSpan = ColumnCount
cell.Text = " "
GVR.Cells.Add(cell)
Return GVR
End Function
|
|
|
|
|
Thanks for this code
but when i pasted this code at my page it gives error
Tbl.Controls.AddAt(0, AddEmptyRow)
Line gives error:
Specified argument was out of the range of valid values. Parameter name: index
Raghvendra
|
|
|
|
|
Exchange index for the rownumber you want to insert the new row at
|
|
|
|
|
I made a mistake in my code when i removed it it work properly
Thanks a lot
Raghvendra
|
|
|
|
|
Sir this code only help you in adding one row but when u want to add more row how to deal with
I mean
i added a row in which text box was there thrugh u can enter data but after filling it i want to add more rows to it
but i m not able to do it
Raghvendra
|
|
|
|
|
Where is your data coming from that prevents you from adding it the normal way via a dataset for example?
|
|
|
|
|
Sir in this data is not coming from anywhere but i m filling data thrugh this grig rows
Raghvendra
|
|
|
|
|
I'm not understanding what you're trying to achieve.
|
|
|
|
|
Sir i want to make r grid by which i can enter my records
so i need rows thrugh which i can enter Data (I need sotething like
sqlserver tabels in which when u want to fill data manually at adds another row to it the moment u start filling data in to rows
Raghvendra
|
|
|
|
|
Is it something like this[^] you mean?
Another method is here[^].
|
|
|
|
|
First of all thanks for cool lisining ,i mean since last i hour i m not able to tell u what i need even then u r lisining to me
Ok Sir this was not what i needed
i need a grid view control which will show me some rows at fost time i will open page lets suppose 3 rows ,
now i have 5 enteries to fill by these rows si first i will enter 3 record in 3 rows then i want to add 2 more rows so i can enter my rest of the records
for this suppose that i have a button addrows ,outside my grid
and i want ,the moment i click addrows button i would be able to add new rows thrugh it
so can u please guide me how to add more rows when i clicjk button
Raghvendra
|
|
|
|
|
You could of course experiment with the first code I sent to you, exchanging the line:
Dim GVR As GridViewRow = New GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Insert)
But it's nothing I've tried.
I would keep it simple. Check out this one[^]
|
|
|
|
|
Check out this[^] one too.
|
|
|
|
|
First of all thanks for cool lisining ,i mean since last i hour i m not able to tell u what i need even then u r lisining to me
Sir bcos i have to do it by today so please
Ok Sir this was not what i needed
i need a grid view control which will show me some rows at fost time i will open page lets suppose 3 rows ,
now i have 5 enteries to fill by these rows si first i will enter 3 record in 3 rows then i want to add 2 more rows so i can enter my rest of the records
for this suppose that i have a button addrows ,outside my grid
and i want ,the moment i click addrows button i would be able to add new rows thrugh it
so can u please guide me how to add more rows when i clicjk button
Raghvendra
Raghvendra
|
|
|
|
|
Hi friends,
I have created a NUnit plugin and testing giving the connection and stored procedure
The tests works fine for sp refering single table under the condition the test method passes all the paramters in th stored procedure.Issue arises when my sp refers two tables and when both tables have common column name
ERROR: Duplicate name(column name)occurs.
Is there anyway to solve this issue??
Thanks In Advance,
praveen
|
|
|
|
|
|
Hi Anand,
Thanks for the suggestion .But in my case the Stored procedure refer to both the tables and iam not priviledged to change the stored procedure.
Thanks,
praveen
|
|
|
|
|
This is not ASP.NET Question.. go to right forum
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
|
Dont repost ur question !!!
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
onClick = "window.open (this.href, 'popupwindow','width=850,height=700,scrollbars,resizable');return false;">
this is mine, make your code the same and see if that works
|
|
|
|
|
i am using .net 2005.i do my project in asp.net.
My project title is master log attendance.
our project is mainly used for see the employee attendance details.
i want vb.net or C# code for,how to put 'x' at date field in gridview.
here 'x' means present.
date field will displayed as what we select from date and to date.
i am using 2 tables.first table name as emp_details contain 2 field names as emp_id,emp_name.
second table name as attendance contain 2 field names as emp_id,date.
employees are put attendance daily.
in web form i keep emp_name,from date,to date.
i select emp_name,from date and todate.
in following example i use dash(-) for space.
for (ex):
in emp_details table,
values are
emp_id---emp_name
--11-------ashok
--12-------ramu
in attendance table,
values are
emp_id----date
--11-----05-06-08
--11-----06-06-08
--11-----09-06-08
--12-----05-06-08
--12-----07-06-08
i select emp_name as ashok,from date as 05-06-2008,to date as 09-06-2008 means
i want to display 'x' in date available in table for that selected name as ashok in gridview as follow.
emp_id--name----05-06-2008---06-06-2008 --07-06-2008 --08-06-2008 --09-06-2008
---11----ashok------------x----------------x---------------------------------------------------x
here no 'x' for 07-06-2008 and 08-06-2008 for ashok.because no date(07-06-2008 and 08-06-2008 ) for id of ashok in attentance table.that means he is absent.
i select emp_name as all emp_name,from date as 05-06-2008,to date as 09-06-2008 means
i want to display 'x' in date available in table for that particular name in grid view as follow
emp_id--name---05-06-2008---06-06-2008 --07-06-2008 --08-06-2008 --09-06-2008
---11---ashok------------x-----------------x---------------------------------------------------x
---12---ramu-------------x--------------------------------x
here no 'x' for 07-06-2008 and 08-06-2008 for ashok.because no date(07-06-2008 and 08-06-2008 ) for id of ashok in attentance table.that means he is absent.
like wise no 'x' for 06-06-2008,08-06-2008 and 09-06-2008 for ramu.because no date(06-06-2008,08-06-2008 and 09-06-2008) for id of ramu in attentance table.that means he is absent.
i want vb.net or C# code for to put x in date field in grid view.
so how to put 'x' in date field in grid view.if employee present.
|
|
|
|
|
Are you using any GridView inbuild features Like Paging,Sorting... etc ?
If no then you should not user Griview for this purpose
Repeater control is best for displaying the data.
There you can have your won type of colouns and you can show the things as you want.
For example in these scenario create a user control which will common for each row
This user control will be your item template
You can show as you want.
Else create a Custom Control here you will get more power as you will be resposible for rensering all HTML content in the Page
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
Check My Blog
|
|
|
|
|
I find using a pivot query easiest. Then the database takes care of the work.
Examples on pivot queries here[^]
|
|
|
|