2014年7月13日 星期日

[RESOLVED] string query for gridview








Height="335px"

style="font-size: medium; margin-right: 0px;" Width="805px"

AllowPaging="True"

onselectedindexchanged="GridView1_SelectedIndexChanged">





















HeaderText="Name" DataField="EMP_NAME" />


HeaderText="Employee Code" DataField="employee_code" />


HeaderText="PF NO" DataField="PF_NO" />




DataField="dol" />


DataField="F_NAME" />


DataField="DOB" />


DataField="SEX" />


DataField="rol" />
















































onclick="generate_Click" />









I have bound it to the database. I want to access its  values in another page.


When i check a row and click generate it should  be accessible in other pages as well.


 I was using the followin in .cs page:


protected void generate_Click(object sender, EventArgs e)

{

foreach (GridViewRow row in GridView1.Rows)

{


CheckBox chkBx = (CheckBox)row.FindControl("chk");


if (chkBx.Checked && chkBx!=null)

{

Response.Redirect(string.Format("covering_expn.aspx?name=" + row.Cells[1].Text));

}


}


grdveiw();


 But its not accepting the parameters in the other page...Please help.



You can't access its value in the another page directly.


You have to use session variable to store its value.


Regards,



set breakpoint on this line and check value of row.Cells[1].Text... is it non empty string?


Response.Redirect(string.Format("covering_expn.aspx?name=" + row.Cells[1].Text));


if yes, u can try this


Response.Redirect("covering_expn.aspx?name=" + row.Cells[1].Text);


hope this helps...



Hi,


I hope you want to try get the parameter value of "name" query string.


First please check that "row.cells[1].text" return a non empty string.


Hope this helps


Thanks!!



Thank you all...Laughing



how to access them in another page?



i think you want to read just the Query-Stirng parameter, that you have just set in first page?


// Page_Load event of second page

var param = Request.QueryString["name"];

then follow the above code. thanks 




沒有留言:

張貼留言