|
There is no Row in iintellisense.
|
|
|
|
|
i think you need the value of that row to display the details, if i am right then bind the commandargument field with Id. and as you
describe that commandname is fire then you get the value of commandargument.
hope this is fine with you,
if anything else please put your exact requirement.
Regards
Keyur Satyadev
|
|
|
|
|
You cannot get the row as e.row
use the following code
<br />
int index = Convert.ToInt32(e.CommandArgument);<br />
GridViewRow row = GridView1.Rows[index];<br />
There is also another way to get the row is
<br />
GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);<br />
Hope it help
Cheers!!
Brij
|
|
|
|
|
hi Brij,
Then how do I get the value of say cell 2 i.e ["name"] or 3 i.e. ["lastname"] ?
Note that this code returns "" whereas there is data in there.
grid.Rows[12].Cells[4].Text
return ""
Thanks
|
|
|
|
|
if you need the multiple data such as name,lastname etc. then bind the Id as CommandArgument field and when the row command fire make query in database passing with id (command argument value) and fetch the details of that row. in this way you get the multiple values.
if you need only single value such as lastname or name then bind the commandargument field with that field and rowcommand event you get this value using e.commangargument.
hope this is fine with you.
Regards
Keyur Satyadev
|
|
|
|
|
Thanks for your input but for business purposes I prefer to continue with the method Brij is suggesting.
Any suggestions on my previous question to Brij please?
thanks
|
|
|
|
|
It should give ,please see it in the quickwatch that you are getting the actual row with all the controls or not..
I have used it several times...
if you some control on the row you can use row.findcontrol() mathod..
Cheers!!
Brij
|
|
|
|
|
I can get this (see below) and there are template fields but I can not see anything else.
(int)grid.DataKeys[Convert.ToInt64(e.CommandArgument)].Values[0]
Iin case it helps you:
in grid_RowUpdating event, I can retrieve values fro mthe grid, i.e.:
string strID = grid.DataKeys[e.RowIndex].Value.ToString();
string strArchiveID = ((Label)grid.Rows[e.RowIndex].FindControl("lblArchiveID")).Text;
But can not retrieve anything except the key from the grid_RowCommand event
Any thoughts please?
Thanks
modified on Thursday, January 28, 2010 6:03 AM
|
|
|
|
|
Can you pls post the code snippet aspx part and rowcommand function part
Cheers!!
Brij
|
|
|
|
|
I will try an alternative way and will let you know...
Thanks
modified on Thursday, January 28, 2010 6:28 AM
|
|
|
|
|
Also have a look to the following links.
First
msdn link
Cheers!!
Brij
|
|
|
|
|
You cannot get the row as e.row.cell and e.row.cell.control
use the following code
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
string Rating = ((TextBox)GridView1.Rows[Index].Cells[2].Controls[0]).Text;
string Rating = GridView1.Rows[Index].Cells[2].Text;
Hope it help
Regards,
Vinay
|
|
|
|
|
I get this error:
Cannot cast 'grid.Rows[index].Cells[5].Controls[0]' (which has an actual type of 'System.Web.UI.LiteralControl') to 'System.Web.UI.WebControls.TextBox'
p.s. some of the gridview fields are templatefields.
Anythoughts please?
|
|
|
|
|
I even converted it to literalcontrol but returns just spaces in a string.
Not sure what is wrong?
|
|
|
|
|
Solved by referring to the correct control names...
Many thanks
|
|
|
|
|
I create 10 radcombobox and fill the values 1 to 10 in each Radcombobox.
This has done in code behind using c#.
I want to write the event for the radcombobox in the design code.
Evnnt is OnClientSelectedIndexChanged.
And i want to call the event from code behind.
During calling the java script function i have to pass some parameters.
This parameters may be the number of comboboxes and selected combobox id.
In the javascript function I have to done some operations using my logic.
If anybody know please post the answer.
|
|
|
|
|
Hi,
I have Gridview in which there is 1 textbox and requiredfield validator , this gridview is inside updatepanel but the required field is not firing on async postback.
|
|
|
|
|
One way,you can validate the textbox from javascript..
Cheers!!
Brij
|
|
|
|
|
I agree with you Brij.
This will avoid unnecessary complexity.
|
|
|
|
|
I need some hacks i know that javascript can solve my problem but because there is already tested validation controls i want to implement that.
|
|
|
|
|
From javascript,I mean fire the validatiors from a javascript functin .You just need to give a group name to your validators that you want to get fired on postback.First execute a js fubction that will be executed before any postback and in that js function,put the code
Page_ClientValidate('GroupName') it will fire all the validators with this GroupName and return true or false accordingly.Based on it you can take decision whether to postback or not.
Cheers!!
Brij
|
|
|
|
|
i have following datalist in WhatsNews.aspx page.
<br />
<asp:datalist id="DL1" runat="server" ItemStyle-BorderColor="#c7c7c6" CssClass="HomePageTitles"><br />
<ItemTemplate> <br />
<asp:HyperLink Runat ="server" Target="_Parent" NavigateUrl ='<%#"page.aspx?id=" + DataBinder.Eval(Container.DataItem, "NewsArticleID").ToString()%>' ID="Hyperlink1"> <br />
<%#DataBinder.Eval(Container.DataItem, "NewsArticleTitle")%> <br />
</asp:HyperLink> <br />
</ItemTemplate> <br />
<AlternatingItemStyle BackColor="#FFFFFF" /><br />
<ItemStyle BackColor="#e7e3e3" BorderColor="#e7e3e3" /><br />
</asp:datalist> <br />
in above code i am setting to open the links in parent window.
and in home page i am adding WhatsNew.aspx using iframe.
<br />
<iframe frameborder="0" marginheight="1" marginwidth="1" hspace="1" width="390" height="450px"<br />
scrolling="no" src="WhatsNew.aspx"></iframe><br />
when i open home page and click a link in whatsnew section, IE 8 opening the links in a new window.
but firefox 3.5.7 opens in parant window, just like i want.
how can i make IE 8 also open the links in parent window?
|
|
|
|
|
|
Hello,
I am trying to build a master detail functionality...
At present, there is a web page i.e. page1.aspx with search functionality. When the criteria is entered then the search button can be clicked and then the GridView gets populated with data. In this GridView, a number of the fields of the selected row can be edited as per business requirement.
Now I would like the user to be able to see and edit more fields related to the selected row in the gridview. These are extra fields which are not viewable in the gridview.
Question:
Is it best to have another page i.e. page2.aspx to see and edit these extra fields or is it better to have these extra fields (One in each control) just below the gridview in page1.aspx ?
Thanks
|
|
|
|
|
If it is just few items, mostly single-line text / dropdown values then do it on the same page. If you need to edit more than one multi-line text then use page2.aspx
|
|
|
|