I have added a new hyperlink column to grid and given datanavigation field and datanavigation url as ~/xyz.aspx?code={0}
where {0} is indicating the datanavigation filed. but i am unable to pass query string
please help
.
You will need to add something like the code I have below in your ItemDataBound event.
{
strInvoiceNmber =
strTransID = tempTableCell.Text;
tempTableCell = e.Item.Cells[17];
strInvoiceNmber = tempTableCell.Text;
lbReport.Text = strInvoiceNmber;
}
SIR,
I want to pass querystring on field 1 of webgrid with values paasing as
~/deails.aspx?a=field1&b=field2
please guide.
<tusharcomtek> wrote in message news:199995@10.0.1.98... SIR, I want to pass querystring on field 1 of webgrid with values paasing as ~/deails.aspx?a=field1&b=field2 please guide. http://helpcentral.componentone.com/cs/forums/p/73635/199995.aspx#199995
sir, Your things are working but only for one field. I wanted to pass two or more fields value then what to do.
as stated in my example
you provided solution for one field only but problem is for more then one field.
Tushar Shah
<tusharcomtek> wrote in message news:200654@10.0.1.98... sir, Your things are working but only for one field. I wanted to pass two or more fields value then what to do. as stated in my example ~/deails.aspx?a=field1&b=field2 you provided solution for one field only but problem is for more then one field. Tushar Shah http://helpcentral.componentone.com/cs/forums/p/73635/200654.aspx#200654
I know this is an old post but I am tired of seeing people put information out here that is just totally wrong and dumb.
Build the hyperlink dynamically in your SELECT query be it a pass through or stored procedure and return it to your grid as a field:
SELECT '<a href=''myPage.aspx?Field1=' + dbField1 + '&Field2=' + dbField2 + '''>I will go to this page with args</a>' As myLink
FROM myTable
ORDER BY whatever
This is setup for a stored procedure using single tick marks for quotes. If you do a pass through query you will need to modify the tick marks a little with double quotes.
Put the data >> myLink << in a cell in your Grid. It will be a hyperlink. When you click on it you will travel.
Thanks that is very helpful. I am also using a link button to allow users to delete the rows. The problem is that now the customer wants to display all rows but only allow the ones who can (original entry user and Admins) to be able to Edit or Delete the rows. The edit is easily handled by your suggestion above but I am using the LinkButton and the C1WebGrid.DeletingCommand event to do the deleting. Now I have the code written to just not delete the row when they are not suppose to but I really would like to be able to not even put the Delete LinkButton up when they cannot delete. Any great ideas? I have been looking at the Databind event but it really has nothing to do with the LinkButton logic (at least that I could find).
Thanks
Mike
I'm not exactly sure what you are saying but if I understand you do this: in your select statement create a field for each row that defines WHO can delete this specific record. Populate the grid row by row with a datareader. As you are looping through the datareader adding rows to the grid compare the logged on user with the field and see if they are the same. If they are not either do not add the link button or disable it.
while(dr.read())
if (user == dr["authUser"].ToString())
//add the control or add the control and disable it
Getting close. The problem is that I really don't know how to add rows to the grid row by row.. Each row in the grid appear to be a C1Item and there is a collection of Items in the Grid but it is read only. Any examples of not using databinding to populate the grid?
Thanks for your help and the post that started this segment really worked well.
I found the answer (I believe) in one of Sergey's old posts. During the databind event you can modify the controls collection of the individual cells. This will allow me to either remove the linkbutton or put a blank label in it's place for the rows that individuals are not eligible to delete.
Thanks for all you help